Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a problem with three forms - one is the menu for the other two. I can open the other two forms from the Menu but the menu stays in the background. When I close the new form a totally new Menu opens leaving me with three forms on screen etc. I know that there is a way of hiding the Menu or the other forms when I return to the Menu but, try as I might, my screen keeps being populated by these forms.

 

I would appreciate any help that you may be able to give.

 

Thanks.

Posted

ok, opening forms in vb.net is totally different than VB6

u gotta do this:

 

under menuitem1_click:

dim mynewform as new form2

 

mynewform.open or .load - something i dont remember right now

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Posted

That was one of the ways that I tried. I used:

Dim FrmMaint As New Maintenance

frmMaint.Show()

 

It works but the Menu form is still behind the Maintenance form. How do I hide the Menu form until the Maintenance form is closed? When I close the Maint form (which I have managed) I then need the Maint form to disappear and the Menu form to reappear. At the present time it just stays behind the new Menu form so I have the original Menu, the Maint and then the new Menu in a stack.

  • Leaders
Posted

in form1 :

Dim FrmMaint As New Maintenance
Me.AddOwnedForm(FrmMaint)
frmMaint.Show()
Me.Hide()

 

in form2 ( Maintenance ) :

   Dim frmMain As Form1 = Owner '/// the Menu form

   Private Sub Form2_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
       Owner.Show() '/// show the Menu form again.
       Me.Close()
   End Sub

Posted
dynamic_sysop, dont use Close() method of the form in its closing event, it will cause StackOverflow exception.

:)

 

 

yeah true that

 

isn't the .close statement actually processing all procedures in the form closing event anyways

  • *Experts*
Posted
yeah true that

 

isn't the .close statement actually processing all procedures in the form closing event anyways

 

Yeah, Close() raises the Closing event before actually closing the from so you still have a chance to cancel the form closing, or do some cleanup code.

Posted
I am trying to attach the project but I'm new to this and am having problems - please bear with me!!

 

oh sorry..

 

u need winZIP <http://www.winzip.com> take out the EXE file in the BIN folder so that there will be no viruses(or something like that

:rolleyes: )

 

 

anyway u got your problems fixed right?

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...