Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Why does Microsoft do this or am I missing something:Keypress event missing in VB.NET 2008

Why does Microsoft do this or am I missing something:Keypress event missing in VB.NET 2008

Scheduled Pinned Locked Moved Visual Basic
csharpjavascripthelpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 4417354
    wrote on last edited by
    #1

    Hi all Though its great to have new features with every release, it sucks if Microsoft takes away old stuff that worked actually great. I have a searchtextbox with a search button. And what I want to build in is if someone enter something in the textbox and press enter it should hit the underlying code. For this I need to use the textbox Keypress Event. If you look at the code below, I get an error: Event 'KeyPress' cannot be found I have to use VB, its the company's policy.No Javascript Private Sub SearchTxt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles SearchTxt.KeyPress If Asc(e.KeyChar) = Windows.Forms.Keys.Enter Then GoButton.PerformClick() End If End Sub Thank you for your time

    T J C 3 Replies Last reply
    0
    • U User 4417354

      Hi all Though its great to have new features with every release, it sucks if Microsoft takes away old stuff that worked actually great. I have a searchtextbox with a search button. And what I want to build in is if someone enter something in the textbox and press enter it should hit the underlying code. For this I need to use the textbox Keypress Event. If you look at the code below, I get an error: Event 'KeyPress' cannot be found I have to use VB, its the company's policy.No Javascript Private Sub SearchTxt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles SearchTxt.KeyPress If Asc(e.KeyChar) = Windows.Forms.Keys.Enter Then GoButton.PerformClick() End If End Sub Thank you for your time

      T Offline
      T Offline
      Tom Deketelaere
      wrote on last edited by
      #2

      Can't test it in 2008 at the moment but you can just use the 'keydown' event.

      Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
      If e.KeyCode = Keys.Enter Then
      gobutton.performclick()
      End If
      End Sub

      1 Reply Last reply
      0
      • U User 4417354

        Hi all Though its great to have new features with every release, it sucks if Microsoft takes away old stuff that worked actually great. I have a searchtextbox with a search button. And what I want to build in is if someone enter something in the textbox and press enter it should hit the underlying code. For this I need to use the textbox Keypress Event. If you look at the code below, I get an error: Event 'KeyPress' cannot be found I have to use VB, its the company's policy.No Javascript Private Sub SearchTxt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles SearchTxt.KeyPress If Asc(e.KeyChar) = Windows.Forms.Keys.Enter Then GoButton.PerformClick() End If End Sub Thank you for your time

        J Offline
        J Offline
        Johan Hakkesteegt
        wrote on last edited by
        #3

        Perhaps you should try to reinstall visual studio, because the KeyPress event has not been removed from vb.net / vs 2008 (I use it in several apps myself). Or is your "searchtextbox" not a regular textbox?

        My advice is free, and you may get what you paid for.

        1 Reply Last reply
        0
        • U User 4417354

          Hi all Though its great to have new features with every release, it sucks if Microsoft takes away old stuff that worked actually great. I have a searchtextbox with a search button. And what I want to build in is if someone enter something in the textbox and press enter it should hit the underlying code. For this I need to use the textbox Keypress Event. If you look at the code below, I get an error: Event 'KeyPress' cannot be found I have to use VB, its the company's policy.No Javascript Private Sub SearchTxt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles SearchTxt.KeyPress If Asc(e.KeyChar) = Windows.Forms.Keys.Enter Then GoButton.PerformClick() End If End Sub Thank you for your time

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Member 4420534 wrote:

          I have to use VB, its the company's policy.No Javascript

          This is either an idiotic statement, or you're writing a website, in which case you should have asked in the ASP.NET forum, and in which case, it's always been the case that you can't handle a keypress event, or a keydown, or anything like that. It would, of course, be utterly retarded for a page to do postbacks every time you press a key.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups