|
-
March 20th, 2001, 11:07 AM
#1
Instantiating Intrinsic controls
Hi,
In my program I have two screens. Screen1 has input box which accepts a numberic value. Screen2 has to display the text boxes based on the input given in the Screen1. For example, if user inputs five in the input box of Screen1, the Screen2 should display five text boxes.
Thanks in advance,
Vamsi
-
March 20th, 2001, 11:14 AM
#2
Re: Instantiating Intrinsic controls
Here is a sample of creating controls at run time.
Start a new project, Paste this code into the General declarations section of the form. Run it.
You will see a clickable button on the form
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
-
March 20th, 2001, 12:16 PM
#3
Re: Instantiating Intrinsic controls
Hi John,
Thanks alot for information.
Thanks,
Vamsi
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
|