How to make a control Tab to the next control when pressing Enter key?
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



How to make a control Tab to the next control...Expand / Collapse
Author
Message
Posted 05/04/2008 1:02:59 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:29:20 PM
Posts: 400, Visits: 1,612
Hi All,

I am creating a VB version of the Currency Control created by Rogerio Mauri here http://forum.strataframe.net/Topic14533-26-1.aspx

Basically I have a whole bunch of currency fields and need a simple solution to all of them. I would like that when the user press the Enter key if will simply go to the next control like the Tab key does.  I found the following code in the Internet:

Private Sub CurrencyTextbox_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

     'Tab to the Next Control when presing Enter

     If e.KeyCode = Keys.Return Then

          SendKeys.Send("{TAB}")

     End If

End Sub

It is working fine, but obviously this will fire for every key pressed in the control, is this the correct event to handle that feature, or is there another way to get this done?

P.S.

I will post the final version of this class when done.

Edhy Rijo
Progytech (Computer Consultants)
Post #16119
Posted 05/05/2008 9:57:04 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:13:06 AM
Posts: 4,104, Visits: 4,176
You will want to look at the SelectNextControl method of a control or a form.  It selects the next control based on the tab order.

For example:

MyTextBox.SelectNextControl()
Post #16137
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 3:48pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.047. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.