|
-
August 16th, 2001, 04:52 PM
#1
TextBox
Hello,
Is there a way to do the following. Instead of draging a textbox control to a form during design time, can I do that from within the code.
I tried
dim x as textbox
load method
set x = new textbox.
Did not work... ANy Ideas??? Please let me know
Thanks
Hisham
Thank You, Hisham
-
August 16th, 2001, 04:59 PM
#2
Re: TextBox
Hee is a sample that will create a Command Button at run time. Easly changed to create a textbox
option Explicit
' Declare object variable as CommandButton.
private withevents cmdObject as CommandButton
private Sub Form_Load()
set cmdObject = frmCreate.Controls.Add("VB.CommandButton", "cmdOne")
cmdObject.Visible = true
cmdObject.Caption = "Dynamic Command Button"
cmdObject.Move 1000, 1000, 1000, 1000
End Sub
private Sub cmdObject_Click()
print "This is a dynamically added control"
End Sub
private Sub Form_Unload(Cancel as Integer)
' get rid of created control
me.Controls.Remove cmdObject
End Sub
John G
-
August 16th, 2001, 05:08 PM
#3
Re: TextBox
Thanx a lot John. Worked fine.
Thanks
Hisham
Thank You, Hisham
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|