With...
End With语句不是一个循环结构。 它执行一系列反复引用单个对象或结构的语句。
这个循环结构的语法是:
With object
[ statements ]
End With
示例:
Public Class Book
Public Property Name As String
Public Property Author As String
Public Property Subject As String
End Class |
Dim aBook As New Book
With aBook
.Name = "VB.Net Programming"
.Author = "Zara Ali"
.Subject = "Information Technology"
End With
With aBook
Proj.MsgDebug.Add(.Name)
Proj.MsgDebug.Add(.Author)
Proj.MsgDebug.Add(.Subject)
End With
'返回结果:VB.Net Programming
'返回结果:Zara Ali
'返回结果:Information Technology
|