Groups | Blog | Home
all groups > vb.net controls > august 2004 >

vb.net controls : How do i to set field focus in a tab control automatically



csgraham74 NO[at]SPAM hotmail.com
8/9/2004 9:22:44 AM
Hi all,

Basically ive built a vb .net app using a tab control for displaying
and entering data. I originally hard coded this with the names of the
various fields to have focus when i moved between tabpages. I feel i
should be able to do this in code by obtaining the highest or lowest
tabindex from each tabpage and somehow setting focus on that field.

If anyone has any helpful ideas or has a work around for this issue i
would be very interested.

Many thanks

John Rugo
8/9/2004 12:57:29 PM
You could tell the field in the tab that is clicked on to focus on that
field.

Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
Select Case Sender.Name
Case "Tab1"
Field_Number1.Focus
Case "Tab2"
Field_Number2Focus
etc...

End Sub


[quoted text, click to view]

AddThis Social Bookmark Button