Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2004

Tip: Looking for answers? Try searching our database.

topmost property and showdialog()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bart - 22 Jul 2004 08:39 GMT
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
rajamanickam - 23 Jul 2004 08:40 GMT
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
Bart - 23 Jul 2004 09:01 GMT
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...
>For c# .. i have given sample code here...
[quoted text clipped - 18 lines]
>
>-rajamanickam
rajamanickam - 23 Jul 2004 10:48 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.