Subscribe to Subscribers

Resources » .NET programming » .NET Framework

Building Windows Application (Address Book) - Part V


Posted Date:     Category: .NET Framework    
Author: Member Level: Gold    Points: 10


This articles speaks about the MDIForm and MdiChild Forms



Building Windows Application (Address Book) - Part V

Building the User Interfaces

We are going to see about the MDI Form and MDI Child forms. In my last section of this
series of articles, I was telling you about the data sharing between the form, where one of
the methods of sharing the data is through the MDIParent and Child relationship. So,
initially we will see the properties of MDI Form and the MDI Child Forms, then we will
see how the data can be shared between the forms.

(Till now we have not started the actual development process except the Login form and
the splash screen. Because, I want to explain all the concept which I am going to
implement first and then start the development process).

Ok, Now lets see the tips in VB.NET

Tips in VB.NET

Text and Image Alignment for Button control

In VB.NET, there are Nine possible ways of aligning the text and image assigned to the
button control, they are any aligned in any one of the following ways.



This can be done by using the TextAlign and ImageAlign properties. In
the property window, the value is assigned as shown in the following picture.



We need to select the any of the alignment by clicking any of the buttons.

These properties will also work with Textbox, label and all other control where the text
can be aligned. (Image Align property is not allowed in the Textbox).

Adding a Scroll Bar to a form

In VB6.0, if we want to design a lengthy form, which requires a scroll bar to view all the
control, cannot be constructed easily. It will be involving lot of coding.

But setting a scroll bar is very simple, Just by setting the AutoScroll property to
True.

Form with a scroll bar.


I hope this two tip would be very useful the application development.

Ok now lets see something about the MDIForm.

MDI Forms

Multiple Document Interface (MDI) forms are able to contain other forms.
An MDI application consists of a parent MDI form and multiple children MDI Forms.
The child forms are kept contained within the parent and more when the parent
moves.
(Taken from Professional VB.Net 2nd Edition).

The characteristics of the MDIForm in VB.Net are same as that of the MDIForm in
VB6.0. But in VB.NET, we can have more than one MDIForm whereas we can have only
one MDIForm in VB6.0 and moreover we had a separate form type called MDIForm in
VB6.0, once if the MDIForm is added the option for adding the MDIForm will be
disabled restricting the user from adding one more MDIForm(in VB6.0).

Building a MDIForm in VB.Net

In VB.NET MDIForm is also a class, which is going to inherit
System.Windows.Forms.Form. We need to add a form as we do for adding a new
ordinary form and then we need to set the IsMdiContainer property to
True.

In VB6.0, we cannot have any other controls like Button, Textbox, label etc., except for
some controls like menu, status bar and the other forms. Where as in VB.NET any
controls can be placed inside the MDIForm.

Now, Lets see how can we add a MDI Child form.

For every form we have a property called MdiParent which takes the MDIForm
as the property value and add that form as the MDIChild form to the MDIForm.

As example, Lets build a demo application. Now, follow the steps given below.


  • Create a new Project called MDIDemo

  • By default you will be having a form called form1, rename it to
    frmMdiChild

  • Add one more form called frmMDIForm

  • Set the IsMDIContainer property value to True

  • Write the following code in the Form Load event of the frmMDIForm

    Private Sub frmMDIForm_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Dim frmchild As New frmMdiChild()
    frmchild.MdiParent = Me
    frmchild.Show()
    End Sub

  • Run the form and see, you will be getting a form as show below.





Lets stop with this for today. In the next section, lets link the two forms frmLogin and
frmSplash and lets design the Administrator Screen.



If you have any queries, doubt or suggestion to improve, please drop me a mail at
asksadha@yahoo.com or asksadha@hotmail.com.

Visit http://sadhasivam.t35.com to know more about me.





Did you like this resource? Share it with your friends and show your love!


Responses to "Building Windows Application (Address Book) - Part V"
Author: Dessi Bravo    15 Oct 2004Member Level: Bronze   Points : 0
This is a cool site where you can get comprehensive samples to assistance a beginner to code properly. How can I start from the beginning. Part1-Part4


Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Building Windows Application (Address Book) - Part IV
    Previous Resource: Building Windows Application (Address Book) - Part VI
    Return to Resources
    Post New Resource
    Category: .NET Framework


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    (No tags found.)

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2013 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.