Solved

Children!

Posted on 1998-12-18
5
438 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
String manipulation in Visual Basic 7 73
VBA: Select SQL query based on a config Sheet v2 11 49
Error with a code discussed on this page 5 32
backup program with robocopy 6 46
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

831 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