?
Solved

methods to swap forms into a vb form or control on a form

Posted on 2003-02-22
3
Medium Priority
?
149 Views
Last Modified: 2010-05-01
Is there a way to create VB forms (that will *never* be seen as individual forms) that would act as, for example, panels on a tabStrip control?

If you've seen Infragistics DataExplorer control (treeview/listview/pane combo), you can simply point to a form's hwnd property and it will display that form as part of the DataExporer control in the pane area.  That's the kind of stuff I want to do with standard VB6 controls if possible.

Summary: I want a main form and subforms that will be dynamically swapped into a control on the main form.

(sorry to be so verbose)

Thanks
0
Comment
Question by:milowe
[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
3 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 600 total points
ID: 7999572
if i understand you correctly:

Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Private Sub Command1_Click()
    Form2.Show
    Form2.Top = 0
    Form2.Left = 0
    SetParent Form2.hWnd, Frame1.hWnd
End Sub

Private Sub Command2_Click()
    Form3.Show
    Form3.Top = 0
    Form3.Left = 0
    SetParent Form2.hWnd, Frame1.hWnd
End Sub

create three forms, form1, form2, form3... on form1 put a frame (frame1) though it could be any container.
For example, i put two command buttons (command1, command2). on command1 click i show form2 and set it's parent to frame1.
on command2 click, do the same for form3.

in the properties window, set moveable = false for form2 and form3 if you don't want the user to be able to move the form.

is this what you're looking for?
0
 
LVL 5

Expert Comment

by:JohnMcCann
ID: 7999736
If you are new to VB you may be better of using ActiveX controls.  Unlesss you have already considered that option.

What you are describing above to me would typically be done using ActiveX controls.

An AcctiveX control acts and works very much like a form.
0
 

Author Comment

by:milowe
ID: 8000664
Beautiful!  Exactly what I'm looking for.  I'm surprised I've never heard of that API call...

Thanks!

Milowe
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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

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