您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關VB.NET語法規則是什么,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
列舉了3個實例了解語法規則的規律。
VB.NET語法規則實例1:
同 Integer 類型的變量比較
Public Class CompareForm Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim 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.Click Dim 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.Click Dim str1, str2 As String str1 = "Hello" str2 = "World" MessageBox.Show("提示:" & str1 + " " + str2) ''MessageBox.show(str1 & " " & str2)也可以 End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim 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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。