?
Solved

Add a sub form to a main form in visual basic

Posted on 2004-03-21
6
Medium Priority
?
926 Views
Last Modified: 2006-11-17
Hi,

Can some one explain to me how to add a subform to a main form in visual basic, then in turn link the forms together?

thanks
0
Comment
Question by:kinton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 22

Expert Comment

by:cookre
ID: 10644895
Add a new form with Project/Add Form, say Form2.

In Form1, when you want to bring up Form2, do:
Form2.Show

If you don't want Form1 to appear while Form2 is up:
Form1.Hide
Form2.Show

When you're done with Form2, do
Form1.Show

And if you want the cursor to be in a particular field:
Form1.Fieldx.SetFocus
0
 

Expert Comment

by:Fox_What
ID: 10645194
Also, if you want form2 to show and not be able
to click on form1 while it is active you can do:

form2.show vbModal, form1.hwnd
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 10646480
You asked about subforms in VB.  VB doesn't support a true subform.  You can simulate it as shown above.

mlmcc
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Expert Comment

by:sreekanth_k77
ID: 10647066
It is so simple to do that.

Create a new form using File --> New Form --> give some name to that form( form2.frm)
then write the following code in button click event.

Private Sub Command1_click()
  form2.show
  form1.hide  ' Write this code if you want to hide the first window.
End Sub
0
 
LVL 2

Accepted Solution

by:
Ivan_Skrinjaric earned 2000 total points
ID: 10652013
0
 
LVL 2

Author Comment

by:kinton
ID: 10722422
Sorry about the bad explanation of the question, but against all odds Ivan, you knew exactly what I needed.  Thanks for your help.
0

Featured Post

Independent Software Vendors: 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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

752 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