468,241 Members | 1,560 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,241 developers. It's quick & easy.

setfocus from tab2 to tab1 in tabcontrol.

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
Nov 20 '05 #1
7 1569
'first select the right tabpage on the tabcontrol
tabcontrol.SelectedTab = tabPageYouWant
'setfocus to control on tabPageYouWant
contol.setfocus

hope it helps

"jaYPee" <hi******@yahoo.com> wrote in message
news:qn********************************@4ax.com...
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

Nov 20 '05 #2
thank you very much. it works fine.

On Tue, 27 Apr 2004 11:39:27 +0200, "EricJ"
<er********@ThiSbitconsult.be.RE> wrote:
'first select the right tabpage on the tabcontrol
tabcontrol.SelectedTab = tabPageYouWant
'setfocus to control on tabPageYouWant
contol.setfocus

hope it helps

"jaYPee" <hi******@yahoo.com> wrote in message
news:qn********************************@4ax.com.. .
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


Nov 20 '05 #3
* "EricJ" <er********@ThiSbitconsult.be.RE> scripsit:
'first select the right tabpage on the tabcontrol
tabcontrol.SelectedTab = tabPageYouWant
'setfocus to control on tabPageYouWant
contol.setfocus


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

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
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
Nov 20 '05 #5
* "Cor Ligthert" <no**********@planet.nl> scripsit:
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'


I am not "wordy", maybe because of my technical education :-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
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.


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c6************@ID-208219.news.uni-berlin.de...
* "Cor Ligthert" <no**********@planet.nl> scripsit:
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'


I am not "wordy", maybe because of my technical education :-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #7
* "EricJ" <er********@ThiSbitconsult.be.RE> scripsit:
jaYPee got it working and that's wat matters most.


Full ACK.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Tamir Khason | last post: by
2 posts views Thread by Patrick McGuire | last post: by
9 posts views Thread by Michael Turner | last post: by
2 posts views Thread by Simon Verona | last post: by
1 post views Thread by =?Utf-8?B?QWxleCBLLg==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.