borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (transparency)Next Topic (Restore Application Window) New Topic New Poll Post Reply
AndreaVB Forum : VB General : creating forms at runtime. whoa.
Poster Message
paulaa
Level: Professor


Registered: 10-08-2003
Posts: 97

icon creating forms at runtime. whoa.

hi.

i'm making a program. in the program i require forms to be created at runtime, and all made similar to another form which i'll create at design time.

also, once these forms have been created i need to change a couple of properties on them, and the text displayed in a label, which will be on the form

i looked at this code from another post, but i don't know how to change it to create forms. not sure if it's even possible using this method.

Option Explicit
Dim WithEvents txtBox As TextBox

Private Sub cmdAdd_Click()
    ' Add a TextBox
    Set txtBox = Controls.Add("VB.TextBox", "txtBox", Me)
    ' Place it where you want
    txtBox.Move 100, 100, 3300, 330
    ' Set it visible
    txtBox.Visible = True
End Sub
Private Sub cmdRemove_Click()
    'Controls.Remove txtBox
End Sub


ta in advance

Paul

[Edited by paulaa on 10-05-2004 at 09:47 PM GMT]

____________________________
My Homepage

10-05-2004 at 09:26 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: creating forms at runtime. whoa.

No, u cannot apply this logic to forms. If you say that all forms would look alike one form then try this:

Private Sub Command1_Click()
Dim frm As New Form1
Static Num As Integer

    Num = Num + 1
    frm.Caption = "Copy of Form1 - " & Num
    frm.Show
End Sub


____________________________
If you find the answer helpful, please mark this topic as solved.

10-05-2004 at 10:03 PM
View Profile Send Email to User Show All Posts | Quote Reply
paulaa
Level: Professor


Registered: 10-08-2003
Posts: 97
icon Re: creating forms at runtime. whoa.

worked like a charm
thanks very much goran

____________________________
My Homepage

10-05-2004 at 10:07 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: creating forms at runtime. whoa.



____________________________
If you find the answer helpful, please mark this topic as solved.

10-05-2004 at 10:16 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : creating forms at runtime. whoa.
Previous Topic (transparency)Next Topic (Restore Application Window) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder