Code Snippets

  

Visual Basic Source Code


Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 98,767 VB Programmers for FREE!. Ask your question and get quick answers from Dream.In.Code experts. There are 1,046 online right now! We're the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a VB Expert

Register to Make This Box Go Away!



What is the Ascii for that button?

This allow you to see what the ASCII equalivient of the button being pressed.

Submitted By: sam_benne
Actions:
Rating:
Views: 277

Language: Visual Basic

Last Modified: May 14, 2008
Instructions: For this you need a label.

Snippet


  1. Private Sub Form_Load()
  2.   KeyPreview = True
  3.   MsgBox ("Press any key ")
  4. End Sub
  5.  
  6. Private Sub Form_KeyPress(KeyAscii As Integer)
  7.   Label1.Caption = "You pressed key: " & KeyAscii
  8. End Sub

Copy & Paste


Comments


cJr. 2008-05-12 20:34:49

This doesn't work for me. It just inserts the key I press into the textbox as I type it and doesn't show the Ascii code or the message before it. Is this for VB6 or is it compatible with VB.NET?

sam_benne 2008-05-13 00:41:18

It is for VB6 And should work as I have just tried it and it did for me.


Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month
-->