加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

7-21 学习VB.net的笔记

发布时间:2020-12-16 23:26:27 所属栏目:大数据 来源:网络整理
导读:Dim 声明关键字 == +xx.ToString ‘ 或 // 都是为加注解 // 定义一个函数 Private Function 方法名 As 返回数据类型 ………. End Funcation //if … else If 条件 Then …. Else End if If …..ElseIf …ElseIf…Else …Endif For……Next 循环 如: Dim int

Dim 声明关键字

& == +xx.ToString

// 都是为加注解

//定义一个函数

Private Function 方法名 As 返回数据类型

……….

End Funcation

//if … else

If 条件 Then …. Else End if

If …..ElseIf …ElseIf…Else …Endif

For……Next循环 如:

Dim intCount as Integer

For intCount=1 To 5

listData.Items.Add(“I’m item ”& intCount &”in the list”)

Next

二:

For intCount as Integer=4 To 62 Step 7

lstData.Items.Add(intCount)

Next

三:反向循环

For intCount As Integer=10 To 1 Step -1

lstData.Items.Add(intCount)

Next

四:ForEach 循环

For Each strFoler As String In _

My.Computer.FileSystem.GetDirectories("E:/")

lstDate.Items.Add(strFoler)

Next

五:Do Until Loop 循环

Dim objRandom As New Random()

Dim intRandomNumber As Integer = 0

lstDate.Items.Clear()

Do Until intRandomNumber = 10

intRandomNumber = objRandom.Next(25)

lstDate.Items.Add(intRandomNumber)

Loop

相对的Do While Loop

Dim objRandom As New Random()

Dim intRandomNumber As Integer = 0

lstDate.Items.Clear()

Do Until intRandomNumber <15

intRandomNumber = objRandom.Next(25)

lstDate.Items.Add(intRandomNumber)

Loop

提前结束循环

For Each strFoler As String In My.Computer.FileSystem.GetDirectories("E:/")

lstDate.Items.Add(strFoler)

If String.Compare(strFoler,"E:/HXH",True) = 0 Then

MessageBox.Show("循环提前结束","提示")

Exit For

End If

Next

结束For Each循环是Exit For

结束Do Unit LoopDo While Loop循环 是 Exit Do

Select Case 参数

.

.

Case Else

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读