setfocus from tab2 to tab1 in tabcontrol.

  • Thread starter Thread starter jaYPee
  • Start date Start date
J

jaYPee

i have a tabcontrol in my form and i have a datagrid in tab2 and want
to validate the data in tab1 before the user can encode data in
datagrid. i set the the datagrid1_enter event to something like this:

Private Sub DataGrid1_Enter(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGrid1.Enter
If IDNo.Text = "" Then
MessageBox.Show("Enter students idno information
before entering school year and semester.")

Me.IDNo.Focus()
End If
End Sub

in order that if the idno is empty which is located in tab1 the focus
will return to idno in tab1.

i used the code above w/ no luck. anyone can suggest a good way to
handle setfocus?

thanks in advance
 
'first select the right tabpage on the tabcontrol
tabcontrol.SelectedTab = tabPageYouWant
'setfocus to control on tabPageYouWant
contol.setfocus

hope it helps
 
thank you very much. it works fine.

'first select the right tabpage on the tabcontrol
tabcontrol.SelectedTab = tabPageYouWant
'setfocus to control on tabPageYouWant
contol.setfocus

hope it helps
 
* "EricJ said:
'first select the right tabpage on the tabcontrol
tabcontrol.SelectedTab = tabPageYouWant
'setfocus to control on tabPageYouWant
contol.setfocus

It's 'Focus', not 'SetFocus'.
 
Hi Herfried,

You can type fast enough.
It's 'Focus', not 'SetFocus'.

Can also as:

Hi Eric,

Probably you know, however for when it is read back on Google.

It's 'Focus', not 'SetFocus'

Herfried

:-)

Cor
 
* "Cor Ligthert said:
You can type fast enough.


Can also as:

Hi Eric,

Probably you know, however for when it is read back on Google.

It's 'Focus', not 'SetFocus'

I am not "wordy", maybe because of my technical education :-).
 
i dont mind (wouldnt expect it any other way from Herfried ;) ), and i know,
it slipped past. hadn't even noticed it.
jaYPee got it working and that's wat matters most.
 
Back
Top