Open window on top

gcollins

Guest
Joined
Sep 13, 2006
Messages
31
Location
Port Hope
Programming Experience
Beginner
Hello,

New to this forum and can't wait, as a begginner I believe I will have lots of posts and lots to learn.

So here is the first one:

I am trying to open another form from my main one but I can't seem to get it to open on top.

Code:

frm_imageViewer.pict_imageDisplay.Image = Image.FromFile(filePath)
frm_imageViewer.Show()
frm_imageViewer.Activate()

It flashes in front for a millisec and then goes behind my main form. I don't want to set the TopMost property to true because If I switch back to my main form it will still be on top.

How do I open it on top? I thought if I used Activate() that was supposed to bring it to the front?

Thanks for your help.

gcollins
 
I haven't had time to look at this properly as i'm off out for about an hour or so, but it looks to me like the problems lies in that you are calling .show from the selected index changed event. It is possible that this event is causing the issue. I'll have a look later.
 
Ok, just tried it and it seems to work fine on this end when i try to open a new form from a button click. I'm sure your problem lies in the selected index changed event.
 
Back
Top