zahidleads
July 25th, 2003, 11:27 AM
Control navigation with EnterKey or Return Key :
I want to navigate from one control(e,g textbox) to another(textbox) with Return or Enter key in asp.net web application instead of TAB key(tab index).How it can be possible.please return some code and technique.
MageIronWolf
July 31st, 2003, 08:22 PM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformskeypresseventargsclasshandledtopic.asp
[CODE]
[Visual Basic]
Imports System
Imports System.Windows.Forms
Public Class Form1
Inherits Form
Public Sub New()
' Create a TextBox control.
Dim tb As New TextBox()
Me.Controls.Add(tb)
AddHandler tb.KeyPress, AddressOf keypressed
End Sub 'New
Sub keypressed(ByVal o As [Object], ByVal e As KeyPressEventArgs)
' The keypressed method uses the KeyChar property to check
' whether the ENTER key is pressed.
' If the ENTER key is pressed, the Handled property is set to true,
' to indicate the event is handled.
If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
e.Handled = True
End If
End Sub 'keypressed
Public Shared Sub Main()
Application.Run(New Form1())
End Sub 'Main
End Class 'Form1
[\CODE]