Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 20-04-2009
Member
 
Join Date: Apr 2009
Posts: 64
How to create Form within Form in VB

Hello all,

As per my knowledge, I have checked an application which has the form within form.
Is it possible to have what i have suggested please provide me some more details regarding it. and if this is possible then the inner window should not go out of the main frame window.

Have anyone come across this Before?

Thanks.
Reply With Quote
  #2  
Old 20-04-2009
Member
 
Join Date: Jan 2006
Posts: 211
Re: How to create Form within Form in VB

The first step in creating an MDI form is to create the parent form. Begin by launching Visual Studio and creating a new Windows Application project named vbMDI. The new project will contain a single form. Change the name of this form in the Properties panel to MDIparent. Also in the Properties panel, change the IsMdiContainer property to True. You will notice that the form background changes to dark grey, the default for MDI containers. This form is now ready to act as the container for the child forms.

Edit the properties of the two new forms so that the title texts are Child Form 1 and Child Form2 respectively. Also, use the properties panel to name the forms MDIchild1 and MDIchild2.

The next step is to add the two new forms (MDIchild1 and MDIchild2) to the parent form (MDIparent). To do this click on the tab for the parent form in Visual Studio and double click on the form to display the event procedures. We will now write Visual Basic code to add the two child forms to the container parent form. To do this we will set the MdiParent property of each child to reference the MDIparent form. Note that because this is the Load event of the actual parent form, we refer to it with the keyword Me rather than by the form name. Having set the Mdiparent of each child we then need to display the form using the form Show() method:

Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MDIchild1.MdiParent = Me
        MDIchild1.Show()
        MDIchild2.MdiParent = Me
        MDIchild2.Show()
End Sub
Reply With Quote
  #3  
Old 20-04-2009
Member
 
Join Date: Dec 2008
Posts: 202
Re: How to create Form within Form in VB

in either version of Visual Basic, are essentially the same as any other class; they have properties, methods, and events, and you can create multiple instances of them. So, assuming you have a form in your project called Form2, the Visual Basic 6.0 code shown here creates three instances of that form and displays them all:

Code:
Dim myFirstForm As Form2
Dim mySecondForm As Form2
Dim myThirdForm As Form2

Set myFirstForm = New Form2
Set mySecondForm = New Form2
Set myThirdForm = New Form2

myFirstForm.Show
mySecondForm.Show
myThirdForm.Show
Now, other than the use of the keyword Set to assign new Form2 instances to your three variables, this code will also work in Visual Basic .NET
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to create Form within Form in VB"
Thread Thread Starter Forum Replies Last Post
Google Chrome is opening in basic HTML form instead of the Standard form Beatrix Technology & Internet 5 25-05-2011 10:21 PM
how to get items in a form to auto-resize with the form using visual basic deansmylie93 Software Development 2 02-05-2011 07:06 AM
How to Auto Populate fields from sub form to form? mich43 Windows Software 6 09-11-2010 11:29 PM
Procedure in VB to create form inside another form Jalabala Software Development 3 16-11-2009 02:14 PM
Problem reloading MDI child form in main form. AFFAN Software Development 3 30-01-2009 09:05 PM


All times are GMT +5.5. The time now is 09:20 PM.