>Visual programming is the art of DRAWING an object and manipulating its properties. This is very easy to do. But, how about if I wanted to create a form and put some objects using pure VB code. Instead of adding a new FORM to my project I would like to just add a MODULE instead and write code.
>
>In VFP we use the CREATEOBJECT function like this:
>
>MyForm=CREATEOBJECT("FORM")
>
>"FORM" is the class of the object I want to create. Then I use the following to show the form.
>
>MyForm.Visible=.t.
>
>This shows a form on the upper left region of the screen. I can then add objects to MyForm and show it using the following.
>
>MyForm.AddObject("MyTextBox","TextBox")
>MyForm.MyTextBox.Visible=.t.
>
>This will put a textbox on the upper left corner of MyForm.
>
>I would like to know how this is done using VB.
I don't think that you can create a form from nothing but you can instantiate one from a dummy-empty one! See this:
Private Sub Command1_Click()
Dim x As Form2
Set x = New Form2
x.Show
End Sub
For adding controls, look at «Dynamic control addition» in VB help.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com