Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
If b 0 Then<br />
c = a / b<br />
Text3.Text = CStr(c)<br />
Else<br />
Text3.Text = "illegal division operation"<br />
End If<br />
End If<br />
End Sub<br />
Select statement<br />
Used for applying many statements depending on one variable. The<br />
general form is:<br />
Select case variable<br />
Case value1<br />
statements<br />
Case value2<br />
Statements<br />
.<br />
.<br />
.<br />
Case value n<br />
Statements<br />
Case else<br />
Statements<br />
End select<br />
Example 7: write a program to print the days of the week when we enter<br />
its number<br />
Sol:<br />
Dim x As Integer<br />
Private Sub Command1_Click()<br />
x = CInt(Text1.Text)<br />
Select Case x<br />
Case 1<br />
MsgBox ("Sunday")<br />
Case 2<br />
MsgBox ("Monday")<br />
Case 3<br />
MsgBox ("Tuesday")<br />
Case 4<br />
MsgBox ("Thursday")<br />
Case 5<br />
MsgBox ("Wednesday")<br />
45