Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Is it possible to hide the main form when another form is open?

 

 

Example, is there a code I can place on my frmUpdater.vb form that will hide (not close) the main form window, then once the frmUpdater.vb form is closed it will make the main form visible again?

Posted

You may have this on a button click event on your main form.

 

dim f as new frmUpdater

 

me.visible = false ' Hides main form

f.show ' Opens new form

me.visble = true ' Shows main form once the new form is closed

Posted

i put the following under the button code:

 

'Run Updater Button

'This code makes it load the updater form

Dim frmUpdater As New frmUpdater

Me.Visible = False ' Hides main form

frmUpdater.Show() ' Opens new form

 

 

 

and then I tried putting the following on the Form_Load code for the Updater form:

 

'Displays Main Form once Updater is closed

Me.Visible = True

 

 

 

But im having a problem, the main form wont show when i close the updater, so where should the code to redisplay the main window be instead of in the Form_Load of the updater form?

  • *Experts*
Posted

Do you want to show frmUpdater as a dialog? If yes then simply pass in your main form as the first paramter into the ShowDialog method, and then from your frmUpdater you can access the form you passed in using the Owner property.

 

If you don't want to show it as a dialog, then the best way would be to edit the constructor of your frmUpdater to accept an instance of your main form, assign the passed in instance to a variable and use it from there.

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...