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 2006

Tip: Looking for answers? Try searching our database.

Unable to hide form? in .NET 2.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob R. Ainscough - 24 Jul 2006 18:55 GMT
Any suggestions on how to make a form not visible when displayed via
Form1.ShowDialog() ?

If I put a button on the form called "Close" and in the click event I put
Me.visible = false, the form closes and my application terminates.  I don't
want this, I just want it to hide (Me.Hide is the same as Me.visible).

I'm using a module1.vb with a sub Main() from the sub Main I Dim Form1 as
New myForm and then call the Form1.ShowDialog.

I can't find any way to hide a Form that is initially displayed (Modal) via
ShowDialog which closing the form.  Is this just not possible in .NET 2.0

Rob.
Jim Wooley - 24 Jul 2006 19:58 GMT
If you hide a modal dialog, you can't do anything until you re-show it and
close it. By definition, a modal dialog must be the topmost form in your
application and takes control of the application until it is closed. I suspect
you would be better off using Form.Show(). Another alternative would be using
the following in your Sub Main:

Sub Main
  dim Form1 as new myForm
  Application.Run(myForm)
End Sub

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx

> Any suggestions on how to make a form not visible when displayed via
> Form1.ShowDialog() ?
[quoted text clipped - 12 lines]
>
> Rob.
Rob R. Ainscough - 24 Jul 2006 21:59 GMT
thanks, yes I ended up using Applicaiton.Run(myForm) and it works well.

I am also overriding WndProc and I need to determine what message is sent
when an the application is being unistalled via (add remove programs or some
other method).

I have WM_QUERYENDSESSION (&H11) but I don't know what value is sent when
Add/Remove programs is run that I assume tries to terminate the running
app??

Thanks, Rob.

> If you hide a modal dialog, you can't do anything until you re-show it and
> close it. By definition, a modal dialog must be the topmost form in your
[quoted text clipped - 26 lines]
>>
>> Rob.

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.