I have a master form, but...

  • Thread starter Thread starter Rob Meade
  • Start date Start date
R

Rob Meade

Hi all,

I am now using a master form to derived my windows forms from.

The problem is - I dont know how!

I have a master form with a menu control across the top, I have then 3
others forms that I want to inherit the master form, I have added inherit
master form etc at the top - in the design view of VS they appear fine.

When it run the application I get a blank (master form) with the menu and
nowt else...

I basically want one of the other forms to load/appear/be visible etc, how
does one call it in - lets say from the click on an item on my menu..?

Any help appreciated - this has been a bit of a show stopper :(

Regards

Rob
 
It almost sounds like you've made the master form out of the main form. Is
that true? Is so then make sure that the master form is just an added form
to the project. Then ensure that all the other forms inherit from the master
form. When the "Click" event for a MenuItem is fired you can create and
instance of the appropriate form and then show it. Is there more to this
story or does this information get you on the right track?
 
...
It almost sounds like you've made the master form out of the main form. Is
that true? Is so then make sure that the master form is just an added form
to the project. Then ensure that all the other forms inherit from the master
form. When the "Click" event for a MenuItem is fired you can create and
instance of the appropriate form and then show it. Is there more to this
story or does this information get you on the right track?

Hi Tim,

Many thanks for the reply.

Turns out after posting here I did a quick google search, the results told
me pretty much what you've said above, when I went to the projects
properties it showed the master form as the one to fire when the application
is run - doh!...so, I've changed that now...

There will indeed be more to this story though! :)

How does one create an instance of the appropriate form...

For example, the master form actually wouldnt make too bad a basic "welcome"
kinda form - just plain, maybe have some instructions on it...basically the
first thing a user would do would be to click "New" from the file menu to
open up the ClientInput form...

Therefore I'd like to create an instance of my ClientInput form...based on
the onclick event (can do this bit)...

Reg's

Rob
 
Lo

Dim ClientInput As New ClientInput
ClientInput.Show()

Got this much - but it opens a new window each time I click on the New menu
item etc as opposed to loading in a different form to the current window?

Regards
Rob
 
Ok, so you can use ShowDialog instead of Show if you want the user to
interact with only the newly opened form, do what they need to do, and then
return to the main form. This will start the new form in a modal state.

Private Sub menuItem1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim ClientInputForm As New ClientInput
ClientInputForm.ShowDialog()
' Do some basic cleanup.
ClientInputForm.Dispose()
End Sub
 
Back
Top