Solved

Children!

Posted on 1998-12-18
5
439 Views
Last Modified: 2010-05-03
This is prolly much easier than i think (well i hope so) but here it goes.
Writing a program with a parrent window and all other forms are children that reside inside it.  Now what I want to do is have a menu option that will open up a form for information to be entered in by the user, then a new form open once the user is done, displaying the info (which will be saved).  Seems easy at first, but what if the user wants 2 of the same windows with different info in each open at the same time.  How can I go about to tell VB, when they open this, use this info in this form.  Then if they want to open another occurance at the same time, use that same form layout again with this new info so they can view both forms at the same time.
0
Comment
Question by:fork121898
5 Comments
 
LVL 1

Accepted Solution

by:
mukvij earned 100 total points
ID: 1451378
Here it goes:

For containing several forms you  make one main from the MDI form and for all other forms set MDIChild =true. Now when you want to open new instance of MDI child you just have to instantiate it by saying set X=New Form1. If you want to save info on a form click it and for all saving statements use 'Me' keyword whenever refrencing objects in form.

For loading new info on this form include code in FORM_ACTIVATE event.

Does it help?
0
 
LVL 1

Expert Comment

by:rayford
ID: 1451379
Create an new simple VB application.  Add a form to the project of type MDI and add another form of type regular form and set the property to MDIChild = True.  Now review the MDIForm and edit the menu.  Add an Item named OPENFORM and when you click the OPENFORM on your graphical representation of the MDIForm it will edit the code.  Insert this code.  Assuming you left the name on your new MDICHILD form simply FORM1 this code will create multiple child windows within your main window.  You will see each looks the same as the last.

Private Sub open_Click()
Dim NewForm As New Form1    ' Declare new form.
NewForm.Show    ' Show new form.
End Sub
0
 
LVL 1

Expert Comment

by:Shyam121498
ID: 1451380
I am enclosing the code which I hope will answer ur Q. I have taken a MDI form and two child forms Form1 and Form2. Form1 is for entering info and Form2  is for showing info.  
Form1 has two controls Text1 and Command1
Form2 has Label1
The MDI will have a menu. When u click menu, Form1will be displayed. The code for that is

Private Sub nee_Click()
       Static i As Integer
       Set frm = New Form1
       frm.Caption = "Form" + Str(i + 1)
       frm.Show
End Sub

Write this code for command button on Form1

Private Sub Command1_Click()
    Dim frShow As Form2
    Static i As Integer

    Set frShow = New Form2
    Form2.Caption = "ShowForm" + Str(i + 1)
    frShow.Label1.Caption = Me.Text1
    frShow.Show
End Sub
0
 
LVL 1

Author Comment

by:fork121898
ID: 1451381
wonderful, thank you much
0
 

Expert Comment

by:onalenna
ID: 1451382
I think the answers given above solve a problem i have.I have done most of what they
say but i think i 'm missing something, so i have to go and crosscheck.

But my i have lost 10 points!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question