\'*****************************************************
\'目的: 在用户列表数组中找出
\' 一个指定用户的第一次出现位置。
\'输入:
\' strUserList(): 被搜索的用户列表。
\' strTargetUser: 要搜索的用户名。
\' 返回: 在rasUserList 数组中rsTargetUser
\' 的第一次出现的索引。
\' 如果目标用户没找到,返回-1。
\'*****************************************************
Function intFindUser (strUserList() As String, strTargetUser As _
String)As Integer
Dim i As Integer \' 循环计数器。
Dim blnFound As Integer \' 目标寻找标志。
intFindUser = -1
i = 0
While i <= Ubound(strUserList) and Not blnFound
If strUserList(i) = strTargetUser Then
blnFound = True
intFindUser = i
End If
Wend
End Function
Dim Msg As String
Msg = "This is a paragraph that will be " _
& "in a message box. The text is" _
& " broken into several lines of code" _
& " in the source code, making it easier" _
& " for the programmer to read and debug."
MsgBox Msg
Dim QRY As String
QRY = "SELECT *" _
& " FROM Titles" _
& " WHERE [Year Published] > 1988"
TitlesQry.SQL = QRY
给常量分组
变量和定义的常量应该按功能分组,而不是分散到单独区域或特定文件中。Visual Basic 一般常量应该在单一模块中分组,以将它们与应用程序特定的声明分开。
Dim Msg As String
Msg = "This is a paragraph that will be " _
& "in a message box. The text is" _
& " broken into several lines of code" _
& " in the source code, making it easier" _
& " for the programmer to read and debug."
MsgBox Msg
Dim QRY As String
QRY = "SELECT *" _
& " FROM Titles" _
& " WHERE [Year Published] > 1988"
TitlesQry.SQL = QRY
第五章:程序验收
第五章:程序验收
第十四条:测试与验收:任何程序需经测试无错后,方能通过验收。