您的位置首页百科知识

vb中flag是什么意思有什么作用

vb中flag是什么意思有什么作用

Option ExplicitDim username(3) As String '变量数组UserName(3)存储四个用户名DIm flag As Boolean '变量Flag用于判定用户身份是否合法Dim inputname As string '变是InputName用于存盯橘储用户录入的用户名Private Sub Form_Load()username(1) = "lImIng"username(2) = "wangfang" username(3) = "zhangsan" username(0) = "xuhua"Flag=FalseInputname = InputBox("请输入用户名称", "用户身份确认", "") Dim i As Integer For I = 0 To 3 If Inputname = username(i) Then flag = True End IfNextIf flag = False ThenMsgBox "用户身份确认失败!退出应用", vbOKOnly, "警告凯答团举坦"ExIt SubEnd IfEnd SubPrivate Sub Picture1_Paint() PictUre1.Print "欢迎你!" + Iputname + "先生"