topmost property and showdialog()

  • Thread starter Thread starter Bart
  • Start date Start date
B

Bart

Hello,

I have a problem using the TopMost property of a form. When the
property of the main form is set to true, it works just fine; the
window stays always on top of all other applications. However, I have
a button on the main form that opens a new form with showdialog().
When opening this second modal dialog, none of the 2 forms stays
'always on top'.
I would like to create a main form that stays always on top of all
other applications and from that main form the user can open some
modal dialogs to make some choices.
Can someone provide me some help on this one?

Thanks,

Bart
 
Hi...
For c# .. i have given sample code here...

private void Button_click(event....)
{
this.TopMost=false;
FormNew objNewForm = new FormNew();
objNewForm.TopMost=true;
objNewForm.ShowDialog();
this.TopMost=true;
}


for vb.net
private sub Button_click(event....)
me.TopMost=false;
dim objNewForm as new FormNew();
objNewForm.TopMost=true;
objNewForm.ShowDialog();
me.TopMost=true;
end sub


-rajamanickam
 
Hi,

Thanks for your reply!
I tried the way you described and now after opening the dialog with
showdialog() the main form is topmost again. Still while the dialog is
opened, none of the 2 forms is topmost, any idea what's the cause of
this problem?

Thanks
 
Hi ,

It is not very clear about your problem... b'ze if the child window called by showdialog.. the use cannot access the parent without answering the child..

before calling the child form change the property of parent ..to false..(ParentForm.TopMost=false and ChildForm.TopMost=true)

after closing the child (if it is showdialog then you can write in next line..b'ze the execution will not go with next line.. the control will be in the showdialog line).. you can change the parent property to true(ParentForm.TopMost=true)

this is the way i said.... (before posting i tested...it was working..)
bye
rajaManickam
 
Back
Top