Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form within a Form 2

Status
Not open for further replies.

007MCSE

IS-IT--Management
Jan 3, 2003
51
US
I've only just started to learn Visual Basic.

What is the command to display a 2nd form when you click a control button on the first form. I want the first form to stay displayed and the 2nd form to overlay.

The second form is called LedColors.frm

Any help would be appreciated
Gary
 

I belive you are talking about MDI forms with your subject line (goto menu of vb Project>Add MDI Form), but from your decription it just sounds like you want to have form1 shown and when you click a button form2 shows (LedColors.Show), but I think you are talking about MDI forms.

Don't forget to set the MDI child property to true.

Good Luck

 
Oh

I did create new form.

I have now created a MDI Form, but it wont let me add anything to it. I even tryed cutting and pasting out of my old form and it comes back with the following error:-

Control "Combo1" does not have the align property, so it cannot be placed directly on the MDI form

any help would be appreciated.
 

A MDI parent will not allow you to put most controls on/in it. You can put a picture box on it to act like a container but I don't think that is what you want to do (could be wrong). I think you want to take your origional form with the button and set it mdichild property to true in the properties box in the design environment and do the same for your second form.

Good Luck

 
007MCSE

I may be wrong, but I read this question as being far simpler than vb5prgrmr is suggesting.

Please paste the following into the buttonclick event of the first form

Code:
 LedColors.show vbmodal

when you click the button the ledcolors form will show until you close it (by clicking the X button probably) Both form will be shown.

If I have misunderstood, I am sorry but
>I've only just started to learn Visual Basic.

leads me to believe that MDI forms are nopt what you are asking about.

Good luck

Matt
 
Yes thats correct.
The second form is a settings form that will enable users to change settings in the program.

Private Sub LEDColors_Click()
openform.LEDColors
End Sub

above is the code to open the form, but I get a
"Runtime error 424
Object required"
When I click on the LEDColors button
 
007MCSE

how is the ledcolors form declared, assuming the name is LEDColors

Code:
Private Sub LEDColors_Click()
dim frmLedColours as LEDColors
set frmLedColours = new LEDColors

frmLedColours.show vbModal, me
'openform.LEDColors  Quite where this comes from I don't
'lnow!!
End Sub
try that


matt
 
Hi Matt

You are correct in what I'm trying to do.

When I enter your code

Private Sub LEDColors_Click()
LEDColors.Show vbModal
End Sub

I get the following error

"Compile error
Method or Data member not found"

Thanks
Gary
 
Hi Matt

Thanks very much for your help
That worked......Cool

Thanks again
Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top