Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show UserControl in Form VB6

I want to show the UserControl into the form, this means i need a single form to perform like multiple form
See this image for details:

Just an Example

Can someone help me how to?, and one again, what's the type must i choose to use the usercontrol (Standard EXE, ActiveX EXE, or else).

NOTE: Please DON'T close this question, i just want to know. and thanks.

like image 996
faid Avatar asked Feb 18 '23 06:02

faid


2 Answers

1- Close UserControls in your designer to made them available in toolbox.

2- Drag & Drop them on your main form, made them same size...

3- Use code like this for your operations:

Private Sub Operation1()
    UserControl1.Visible = True
    UserControl2.Visible = False
End Sub

Private Sub Operation2()
    UserControl1.Visible = False
    UserControl2.Visible = True
End Sub

[Choose UserControl type!]

like image 136
Thunder-KC Inc Avatar answered Feb 20 '23 19:02

Thunder-KC Inc


The simplest way, albeit terribly inelegant is to add all the controls to the form and set their visible state as required. THis is normally considered to be somewhat of a kludge though.

The problem lies not with the user controls or programming environment but that the design does not follow a typical Windows UI 'flow'. You might want to redesign based on a more useable workflow.

It's possible that you're simply asking how to use UserControls in a VB project, if so then you should develop the UserControls in one project, make it (so that they get added to the toolbox), and then develop the form in another project using the new UserControls from the Toolbox. For debugging Usercontrols you will need to run two instances of VB, one with the Usercontrols project and the other with the form.

like image 31
UserEleventyOne Avatar answered Feb 20 '23 21:02

UserEleventyOne