In our previous tutorial I discuss on “How to Create Master/Detail Windows Forms” on our Library System Project.
Today we will add MDI Form and create a main menu to open the forms on our project. If you follow closely this tutorial you will have now several Windows Forms on your project.
Please follow the steps below to Add MDI Form and Main Menu on your Library System project.
By default Visual Studio creates a Main Menu automatically for you. But since the default one is not related to our project we will remove some of it and add our own menu.
Default menu:
Library System Menu:
Next we will add a code to open every form on our project. To do this double click “Borrow Book(s)” menu.
There are so many unnecessary codes behind MDI Form. Delete it and leave only the following code:
The code above will simply open the Borrow form in Add state.
getFormState is a public property on Borrow Form. Here’s the code in our Borrow Form.
We need to add Module on our project to handle the getFormState property.
After this you need to the startup object. Read “How to Select Startup Form” on our previous tutorial and choose mdiMain.
That’s it. You can now run your project and see if you can open “Borrow” form.
Back to Visual Basic .NET 2008 Tutorial.