C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

Building Windows Application (Address Book) - Part V


Posted Date: 29 Apr 2004    Resource Type: Articles    Category: .NET Framework
Author: Sadha SivamMember Level: Gold    
Rating: 1 out of 5Points: 10



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.



Responses

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      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Building Windows Application (Address Book) - Part IV
Previous Resource: Building Windows Application (Address Book) - Part VI
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use