* add a button to a page programmatically
* add a textbox to a page programmatically
* add a label to a page programmatically
* add an item list to a page programmatically
* understand how to place these in a certain location on the form
* understand how to change the width and height
* understand how to set readonly and disabled
* understand how to set the text value
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' create button
Dim btn As New Button
' set some button properties
btn.Text = "go"
btn.Top = 45
btn.Left = 190
'add button to form
Me.Controls.Add(btn)
'create textbox
Dim dynamicText As TextBox = Nothing
dynamicText = New Windows.Forms.TextBox
dynamicText.Name = "TimeTextBox"
dynamicText.Location = New System.Drawing.Point(8, 8)
dynamicText.Size = New System.Drawing.Size(232, 20)
dynamicText.TabIndex = 0
Me.Controls.Add(dynamicText)
'create label
Dim lbl As New Label
lbl.SetBounds(10, 50, 100, 25)
lbl.Text = "Hello World!"
Me.Controls.Add(lbl)
'create listbox
Dim lstEmails As ListBox
lstEmails = New System.Windows.Forms.ListBox()
'
'lstEmails
'
lstEmails.IntegralHeight = False
lstEmails.Location = New Point(16, 75)
lstEmails.Name = "lstEmails"
lstEmails.Size = New System.Drawing.Size(264, 224)
lstEmails.TabIndex = 0
Me.Controls.Add(lstEmails)
'
End Sub
End Class
No comments:
Post a Comment