B02 四則運算
加:
TextB0x3.text = TextBox1.text & “+” & TextBox2.text & “=” & val(TextBox1.text) + val(TextBox2.text)
減:
TextB0x3.text = TextBox1.text & “-” & TextBox2.text & “=” & val(TextBox1.text) - val(TextBox2.text)
乘:
TextB0x3.text = TextBox1.text & “*” & TextBox2.text & “=” & val(TextBox1.text) * val(TextBox2.text)
除:
If TextBox2.text = 0 Then
Msgbox(“分母不可為零”)
Else
TextB0x3.text = TextBox1.text & “/” & TextBox2.text & “=” & val(TextBox1.text) / val(TextBox2.text)
If End
B03 學生選課程式
Form1:
Label3.text = listBox1.items.count * 2
加選:
ListBox1.items.add(TextBox1.Text)
Label3.text = listBox1.items.count * 2
退選:
ListBox1.items.Remove(TextBox1.text)
ListBox1.items.Remove(Listbox1.SelectedItem)
Label3.text = listBox1.items.count * 2
清除: 完成:
Listbox1.items.Clear() End
Label3.text = listBox1.items.count * 2
B04 密碼檢查
From:
Dim x as Integer
確定:
If TextBox1.text = william and TextBox2.text = 12345 then
MsgBox(“歡迎使用本系統!”)
End
Else
MsgBox(“密碼錯誤!”)
x =X+1
If x = 3 then
MsgBox(“您無法登入本系統,請洽系統管理員。”)
End
End If
End If