您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關VB.NET語法規則有哪些的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
VB.NET語法規則實例1:
同 Integer 類型的變量比較
Public Class CompareForm
Private Sub Button1_Click
(ByVal sender As System.Object,
ByVal e As System.EventArgs)
Handles Button1.ClickDim A As Integer = 10
Dim B As Integer = 20
If A <= B Then
MessageBox.Show("提示:A<=B")
Else
MessageBox.Show("提示:A>B")
End If
End Sub
End Class
VB.NET語法規則實例2:
Boolean變量的比較
ublic Class LogicForm
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e
As System.EventArgs) Handles
Button1.ClickDim a As Boolean = True
Dim b As Boolean = False
If a And b = True Then ''
和If a And b Then相同MessageBox.Show("提示:a和b都是True ")
Else
MessageBox.Show("提示:a和b有一個不是True ")
End If
End Sub
End Class
VB.NET語法規則實例3:
同String類型變量比較 String和Integer不同變量的比較
Public Class StrForm
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e
As System.EventArgs) Handles
Button1.ClickDim str1, str2 As String
str1 = "Hello"
str2 = "World"
MessageBox.Show("提示:" &
str1 + " " + str2) ''Message
Box.show(str1 & " " & str2)也可以End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e
As System.EventArgs) Handles
Button2.ClickDim z As Integer
Dim x As String = " 100"
z = 50
MessageBox.Show(x & z) ''
MessageBox.Show(x + z)End Sub
End Class
感謝各位的閱讀!關于“VB.NET語法規則有哪些”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。