7-21 学习VB.net的笔记
2009-07-21 15:14
429 查看
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 Loop,Do While Loop循环 是 Exit Do
Select Case 参数
.
.
Case Else
& == +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 Loop,Do While Loop循环 是 Exit Do
Select Case 参数
.
.
Case Else
相关文章推荐
- Asp.Net Ajax 学习笔记21 VS2008的JavaScript代码提示功能
- 学习笔记,VB.NET使用DirectSound9 (1) 简单播放
- [2004-8-4]VB.Net学习笔记,使用ADO.Net对象访问数据库,将结果写入ListView
- VB.NET学习笔记--类型转换
- 学习笔记,VB.NET使用DirectSound9 (1) 简单播放
- Spring.NET学习笔记21——整合Web Service(应用篇) Level 200
- vb.net学习笔记
- Excel开发学习笔记:VB.net的一些杂项
- Gmap.net-->VB学习笔记
- VB.net学习笔记之串口通讯:System.IO.Ports.SerialPort
- ASP.NET 3.5核心编程学习笔记(21):LINQ查询语法
- VB.net学习笔记(二十四)线程基础
- 学习笔记,VB.NET使用DirectSound9 (2) 声音的特性
- Asp.Net Ajax 学习笔记21 VS2008的JavaScript代码提示功能
- VB.Net学习笔记
- 【深度学习】【Caffe源代码解读3】笔记21 Caffe的基本数据结构之Net
- VB.net学习笔记之发送邮件:System.Net.Mail
- vb.Net中WinForm的开发学习笔记
- [C#] Direct2D 学习笔记 (一)vb.net转换为c#
- 第六章 ASP.NET应用实例 -- 学习笔记