Problems Reactivating Windows Form

  • Thread starter Thread starter simchajoy2000
  • Start date Start date
S

simchajoy2000

Hi,

I'm having a strange problem. I have a windows form with a button on
it and when you click on the button it opens up another windows form.
On this second windows form I perform some error handling to ensure the
user enters data correctly - and if they enter incorrect information
and press the "Ok" button, I want to keep the form open and active so
they can fix the problems. Well, by default the second windows form
loses focus and the focus goes to the first windows form. I tried to
change this behavior by doing all of the following:

Me.Show()
Me.Activate()
Me.Refresh()
Me.Focus()

I tried it individually and all together - it doesn't work, the focus
still goes to the first windows form.

I also tried all of these commands using "MyBase" instead of "Me" just
in case. What am I missing here??

Thanks!

Joy
 
It's hard to tell what is happening from your description. How are you
opening the second form, Show() or ShowDialog()? And what is the code in
your second form's OK button click event handler?

The second form shouldn't dismiss automatically. You either have to dismiss
it by calling Me.Close() or Me.Hide() or having the user hit the close box.
 
Back
Top