The TextBox Class The Timer Class

200 Set the Size and Location of each control. groupBox1.Size = New System.Drawing.Size248, 88 groupBox1.Location = New System.Drawing.Point112, 168 radioButton1.Location = New System.Drawing.Point16, 10 radioButton1.Size = New System.Drawing.Size104, 20 radioButton2.Location = New System.Drawing.Point16, 50 radioButton2.Size = New System.Drawing.Size104, 20 Add radioButton1 and radioButton2 to the GroupBox. groupBox1.Controls.AddRangeNew Control {radioButton1, radioButton2} Add the GroupBox to the form. Me.Controls.AddgroupBox1 Like a checkbox, the appearance of a radio button is determined by its Appearance property, which can take one of two members of the Appearance enumeration: Normal the default and Button . You dont normally use Appearance.Button because it will make your radio button look like a button. The CheckAlign property determines the text alignment of the radio button. Its value is one of the members of the ContentAlignment enumeration: BottomCenter , BottomLeft , BottomRight , MiddleCenter , MiddleLeft the default, MiddleRight , TopCenter , TopLeft , and TopRight . The Checked property takes a Boolean. Setting this property to True selects the radio button and deselects others in the group; setting it to False unselects it.

5.1.16 The TextBox Class

This class represents a text-box control, a control that can accept text as user input. Its major properties are: Multiline This property can be set to True indicating that multiple lines are permitted or False single-line mode. By default, the value for this property is False . AcceptsReturn If True its default value, and if the Multiline property is also True , pressing the Enter key will move to the next line in the text box. Otherwise, pressing Enter will have the same effect as clicking the forms default button. CharacterCasing This property determines how characters that are input by the user appear in the text box. It can take any member of the CharacterCasing enumeration: Normal the default, Upper , and Lower . Setting this property to CharacterCasing.Upper translates all input characters to uppercase. Assigning CharacterCasing.Lower to this property converts all input to lowercase. CharacterCasing.Normal means that no conversion is performed on the input. PasswordChar This property defines a mask character to be displayed in place of each character input by the user, thereby turning the text box into a password box. This property applies only to a single- line text box i.e., a text box whose Multiline property is False . It affects the display, but not the value of the Text property. ScrollBars 201 In a multiline text box, this property determines whether scrollbars are shown on the control. The property can take any member of the ScrollBars enumeration: None the default, Horizontal , Vertical , and Both . TextAlign This property determines how text is aligned in the text box. It can take any member of the HorizontalAlignment enumeration: Center , Left , and Right .

5.1.17 The Timer Class

The Timer class represents a timer that can trigger an event at a specified interval. At each interval, a Timer object raises its Tick event. You can write code in the Tick event handler that runs regularly. The Timer will raise its Tick event only after you call its Start method. To stop the timer, call its Stop method. The interval for the Timer is set by assigning a value to its Interval property. It accepts a number representing the interval in milliseconds. The following code, which prints an incremented integer from 1 to 20 to the console, shows how to use a timer: Dim i As Integer Friend WithEvents timer1 As Timer timer1 = New Timer timer1.Interval = 1000 timer1.Start The event handler for Tick. Private Sub Timer1_Tick _ ByVal sender As System.Object, _ ByVal e As System.EventArgs _ Handles Timer1.Tick If i 20 Then i = i + 1 Console.WriteLinei Else timer1.Stop End If End Sub

5.1.18 Other Controls and Components