1.创建窗体
在弹出菜单中选择【添加】---->【Windows窗体】,然后输入窗体名(我都用的默认名),单击完成
2.添加控件
在窗体上添加一个Button按钮
3.添加代码
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
‘-----------------------if多重判断用例--------------------------
‘ If CInt(TextBox1.Text) > 5 Then
‘ MessageBox.Show("你输入的数大于5")
‘ ElseIf CInt(TextBox1.Text) = 5 Then
‘ MessageBox.Show("你输入的数等于5")
‘ Else
‘ MessageBox.Show("你输入的数小于5")
‘
‘ End If
‘-----------------------select case用例-------------------------
‘Dim a As Integer = CInt(TextBox1.Text)
‘Select Case a
‘ Case 1, 3, 5, 7, 9
‘ MessageBox.Show("你输入的是小于10的单数")
‘ Case 8 To 12
‘ MessageBox.Show("你输入的是8到12之间的数")
‘ Case 13 To 25
‘ MessageBox.Show("你输入的是13到25之间的数")
‘ Case 31 To 35, Is > 50
‘ MessageBox.Show("你输入的是31到35之间的数或大于50的数")
‘End Select
‘----------------------for.....next语句用例---------------------
‘Dim i, s As Integer
‘For i = 0 To 100
‘ s = s + i
‘Next
‘MessageBox.Show("累计和为" & (s))
‘----------------------for.....each语句用例---------------------
‘ Dim i As Integer
‘ Dim a() As String = {"第二章", "语法学习", "学习"}
‘ For Each a(i) In a
‘ MessageBox.Show(a(i))
‘ Next
End Sub
End Class
今天就写这么些吧!
明天继续!