Monday, February 7, 2011

How to add a button, and a textbox to a page programmatically.

I will demonstrate how to add a textbox to a program programatically.

Dim textbox1 As New TextBoxtextbox1.Size =
TextBox8.ReadOnly = True  'makes the text box Read-onlytextbox1.Name = "TextBox1" 'Creates a name for the textboxTextBox1.Location =
TextBox8.Width = AutoSize
TextBox8.Height = AutoSize


'These lines of code Place a button of code Dim button As New Button 'adds a button to the formbutton.AutoSize = Truebutton.Text = "Exit" 'Places a name on the button
button.Location =

'This code adds a list box to the form
Dim lstShoes As New ListBox
Me.Controls.Add(button) 'Adds button to controlsNew Point(5, 239) ' Places the button in a specific area on the form.
Me.Controls.Add(textbox1) 'Adds textbox1 to the control
New Point(60, 185)'this operation sets the location of the new textboxes
New Size(150, 20)' sets size

No comments:

Post a Comment