HowTo Textbox.Focus with a Panel

J

jp2msft

I have several applications that use panels as screens for different parts of
our application.

Panel1.BringToFront()
Panel1_Textbox.Focus()
' do something with a control on Panel1
Panel2.BringToFront()
Panel2_Textbox.Focus()
' do something with a control on Panel2

When the applications are running, I can see the Textbox controls receiving
focus for an instant, then Nothing has focus!

How do I set the Focus on the Textbox controls ... and have it STAY there?
 
P

PvdG42

jp2msft said:
I have several applications that use panels as screens for different parts
of
our application.

Panel1.BringToFront()
Panel1_Textbox.Focus()
' do something with a control on Panel1
Panel2.BringToFront()
Panel2_Textbox.Focus()
' do something with a control on Panel2

When the applications are running, I can see the Textbox controls
receiving
focus for an instant, then Nothing has focus!

How do I set the Focus on the Textbox controls ... and have it STAY there?


Where is this code, in what procedure?
 
J

jp2msft

It is scattered throughout my code.

It is placed in the Form_Load() first, but that does not work.

If they click the Login button, the Login_Clicked event has
Login_Panel.BringToFront() and Login_Textbox.Focus(), but the Textbox never
receives focus.

After the successfully log in, I call Partnumber_Panel.BringToFront() and
Partnumber_Textbox.Focus(), but the Textbox there never receives focus either.

This happens in other applications, too. Not just this one instance. So, I
presume I am doing something incorrect.

Any thoughts?
 
J

jp2msft

Nobody knows how to do this, I take.

Either that, or people on this group just don't understand my question.
 
P

PvdG42

jp2msft said:
Nobody knows how to do this, I take.

Either that, or people on this group just don't understand my question.
No, I'm sure there are folks out there who do know how to do it, but you
can't expect instant answers in newsgroups.

After experimenting a bit (as time permitted), I have a possibility. Have
you tried putting focus on the desired control in the MouseEnter event? It
appears to work here.
If this suggestion doesn't work for you, and others here don't chime in,
consider posting in the VB.NET group:

microsoft.public.dotnet.languages.vb
 
P

PvdG42

jp2msft said:
Nobody knows how to do this, I take.

Either that, or people on this group just don't understand my question.
To clarify my previous. The MouseEnter event for the panel.
 
J

jp2msft

MouseEnter event for the panel. Understood. I'll give that a go on Monday
(long weekend). Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top