How to use SendKeys?

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2008
Posts: 27
Reputation: Sheryl99 is an unknown quantity at this point 
Solved Threads: 0
Sheryl99 Sheryl99 is offline Offline
Light Poster

How to use SendKeys?

 
0
  #1
Nov 16th, 2008
My form's KeyPreview is set to True. I want to allow my users to use the Enter Key instead of just the Tab key. I have the following code in my form's KeyPress event:

  1. Private Sub frmDesigner_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
  2. If e.KeyChar = vbkeyreturn Then
  3. SendKeys.Send("{TAB}")
  4. End If
  5. End Sub

It doesn't like vbkeyreturn, which I used in Visual Basic 6.0. I think I must be close to having it right. Your help is appreciated!

~ Sheryl
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 32
Reputation: reena12 is an unknown quantity at this point 
Solved Threads: 4
reena12 reena12 is offline Offline
Light Poster

Re: How to use SendKeys?

 
0
  #2
Nov 17th, 2008
Hi,


Private Sub frmDesigner_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
If Asc(e.KeyChar) = Keys.Enter Then
SendKeys.Send("{TAB}")
End If
End Sub
Reena Mehta

Remember to click on Mark as answer on the post that helped

http://www.indianic.com
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 27
Reputation: Sheryl99 is an unknown quantity at this point 
Solved Threads: 0
Sheryl99 Sheryl99 is offline Offline
Light Poster

Re: How to use SendKeys?

 
0
  #3
Nov 17th, 2008
Your solution works! Thank you, Reena!
~ Sheryl
Reply With Quote Quick reply to this message  
Join Date: Dec 2009
Posts: 1
Reputation: hlove4u is an unknown quantity at this point 
Solved Threads: 0
hlove4u hlove4u is offline Offline
Newbie Poster

Hi

 
0
  #4
2 Days Ago
Originally Posted by Sheryl99 View Post
My form's KeyPreview is set to True. I want to allow my users to use the Enter Key instead of just the Tab key. I have the following code in my form's KeyPress event:

  1. Private Sub frmDesigner_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
  2. If e.KeyChar = vbkeyreturn Then
  3. SendKeys.Send("{TAB}")
  4. End If
  5. End Sub

It doesn't like vbkeyreturn, which I used in Visual Basic 6.0. I think I must be close to having it right. Your help is appreciated!

~ Sheryl
just declare your vbkeyreturn, that does it

Dim vbkeyreturn as char=chr(13)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC