Solved

Children!

Posted on 1998-12-18
5
434 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
wonderful, thank you much
0
 

Expert Comment

by:onalenna
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now