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. i need one example keypress event Program in VB.Net

i need one example keypress event Program in VB.Net

Scheduled Pinned Locked Moved Visual Basic
csharptutorial
3 Posts 3 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.
  • S Offline
    S Offline
    somagunasekaran
    wrote on last edited by
    #1

    I need one example program for Keypress event.that is put on Ascii values.so pls tel me one textbox to another textbox.pls tell me the exmple program in VB.Net Thanking You somasundaram G

    K D 2 Replies Last reply
    0
    • S somagunasekaran

      I need one example program for Keypress event.that is put on Ascii values.so pls tel me one textbox to another textbox.pls tell me the exmple program in VB.Net Thanking You somasundaram G

      K Offline
      K Offline
      king gamo
      wrote on last edited by
      #2

      ///6.0 If KeyAscii = 8 Then Exit Sub End If If KeyAscii = 46 Then If InStr(txtRate.Text, Chr(46)) = 0 Then Exit Sub Else KeyAscii = 0 End If End If If Not IsNumeric(Chr(KeyAscii)) Then KeyAscii = 0 End If ///.Net 2005 If Asc(e.KeyChar) = 8 Then Exit Sub End If If Asc(e.KeyChar) = 46 Then If InStr(txtRate.Text, Chr(46)) = 0 Then Exit Sub Else e.Handled = True End If End If If Not IsNumeric(e.KeyChar) Then e.Handled = True End If End Sub //// this is for trapping only numbersand 1 decimal point in a textbox on the keypress event. hope it helps Love makes the world go round

      1 Reply Last reply
      0
      • S somagunasekaran

        I need one example program for Keypress event.that is put on Ascii values.so pls tel me one textbox to another textbox.pls tell me the exmple program in VB.Net Thanking You somasundaram G

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        All you have to do is handle the KeyDown event of the TextBox. I have no idea what you want to do with the Ascii value, so...

        Private Sub TextBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        ' The keycode is in e.Keycode.
        Console.WriteLine("KeyCode value: " & e.KeyCode )
        End Sub

        Dave Kreskowiak Microsoft MVP - Visual Basic

        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