Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 445
  • Last Modified:

Children!

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
fork121898
Asked:
fork121898
1 Solution
 
mukvijCommented:
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
 
rayfordCommented:
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
 
Shyam121498Commented:
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
 
fork121898Author Commented:
wonderful, thank you much
0
 
onalennaCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now