Hi Claude,
Thanks for you help, but, i don't know the type of my control in advance.
I'm sweeping a collection that contains more values of controls.
As result, i have:
For i = 0 to colControls.Count - 1
strControl = colControls(i).StringControl
Next
In this point, i need to create control starting from the string strControl.
Alerts:
strControl as string
colControls as my collection (can't modify your structure because it is a
external collection - other component that is not on my control)
Then, who can help me?
"Claude Froment" <cl************@rogers.com> escreveu na mensagem
news:14****************************@phx.gbl...
-----Original Message-----
I need add one new unknown control at runtime and the
only one informationthat i have is one string with type of control.
Example:
c = "System.Windows.Forms.TextBox"
How i can create one textbox at runtime in my form1?
.
Hi José
Here is a code sample that will add a text box to your
current form.
Dim objText As TextBox = New TextBox 'Create text control
objText.Visible = True 'Make it visible
objText.Name = "myText"
objText.Location = New Point(10, 10) 'Set the x=10 and y
= 10
objText.Height = 20
objText.Width = 200
objText.Text = "Hello!"
Me.Controls.Add(objText) 'add text to current form
Just cut and past this code sample inside a button click
event and you should see a text box.
Good luck,
Claude