﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » How to make a control Tab to the next control when pressing Enter key?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 01:51:05 GMT</lastBuildDate><ttl>20</ttl><item><title>How to make a control Tab to the next control when pressing Enter key?</title><link>http://forum.strataframe.net/FindPost16119.aspx</link><description>Hi All,&lt;/P&gt;&lt;P&gt;I am creating a VB version of the Currency Control created by Rogerio Mauri here &lt;A href="http://forum.strataframe.net/Topic14533-26-1.aspx"&gt;http://forum.strataframe.net/Topic14533-26-1.aspx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; I found the following code in the Internet:&lt;/P&gt;&lt;P&gt;[quote][codesnippet]&lt;FONT size=2&gt;&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/FONT&gt;&lt;FONT size=2&gt; CurrencyTextbox_KeyDown(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; sender &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Object&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ByVal&lt;/FONT&gt;&lt;FONT size=2&gt; e &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; System.Windows.Forms.KeyEventArgs) &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Handles&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;.KeyDown&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Tab to the Next Control when presing Enter&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; e.KeyCode = Keys.Return &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;SendKeys.Send(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"{TAB}"&lt;/FONT&gt;&lt;FONT size=2&gt;)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#008000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Sub&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;[/codesnippet][/quote]&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;P.S.&lt;/P&gt;&lt;P&gt;I will post the final version of this class when done.</description><pubDate>Mon, 05 May 2008 09:57:04 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to make a control Tab to the next control when pressing Enter key?</title><link>http://forum.strataframe.net/FindPost16137.aspx</link><description>You will want to look at the SelectNextControl method of a control or a form.&amp;nbsp; It selects the next control based on the tab order.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;[codesnippet]MyTextBox.SelectNextControl()[/codesnippet]</description><pubDate>Mon, 05 May 2008 09:57:04 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>