|
-
Nov 20th, 2006, 09:34 AM
#1
Thread Starter
New Member
[02/03] Form Focus issue with VB NET 2003
G'day everyone,
I've been fiddling, trying to do something with forms, but it just isnt working, so I wondered if anyone from this forum can help:
What i have, is a button that when clicked, brings up a second form over the top of the current form (the old form is not hidden).
At the moment, this new form loses focus, it dissappears and the user is left with just the first form, only its for some reason in its minimize state.
Does anyone know what code i can put in to make the original form "pop up" so the user doesnt have to click down on the task bar to retrieve it?
Any help would be muchly appreciated.
Ta,
Axel
-
Nov 20th, 2006, 09:44 AM
#2
Re: [02/03] Form Focus issue with VB NET 2003
You can use ShowDialog on the 2nd form... If that is not what you want, then you can try to use BringToFront on the 2nd form after showing it.
VB Code:
Dim frm2 As new Form2
frm2.Show()
frm2.BringToFront()
-
Nov 20th, 2006, 10:03 AM
#3
Thread Starter
New Member
Re: [02/03] Form Focus issue with VB NET 2003
wow, that was quick, thanks for the reply.
I put that code into the second form under Form_Deactivate (is this when it loses focus? I tried Lost_Focus but it wasnt working).
I didnt want the form to reload, so i took the "new" out that you suggested.
VB Code:
Dim frm2 As Form2
frm2.Show()
frm2.BringToFront()
It gave me this error message:
VB Code:
An unhandled exception of type 'System.NullReferenceException' occurred in Subject Selector.exe
Additional information: Object reference not set to an instance of an object.
and it highlights this: frm2.Show()
(I've renamed the form back to frm2 so it makes sense in relation to the reply you gave me)
Just incase i didnt explain right what im after ( i didnt think i didnt):
When the second form is lost focus (like, by clicking on the form underneath it) I want that original form to be on top. But at the moment when i click it, it goes minimized or something. I want it to flash like msn windows do and pop-up straight away.. if thats possible
Thanks again for the help, i hope that makes it a little clearer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|