您好,登录后才能下订单哦!
这篇文章给大家分享的是有关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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。