关于Msgbox的问题
我写了下面的一段程序,用来运行一个对话框,输入密码后检查密码是否正确,Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox1.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim answer As Object
Dim message1 As String
Dim message2 As String
Dim caption As String
Dim pwd As String
pwd = "a"
caption = "检查密码"
message1 = "密码正确"
message2 = "密码错误"
If TextBox1.Text = pwd Then
answer = MsgBox(message1, 1, caption)
Else
answer = MsgBox(message2, 1, caption)
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
End Class
记得Msgbox的用法介绍是
“MsgBox "Message",options,title
The first argument is the message to be displayed. The second (optional) controls the appearance and behaviour of the dialog box, and the third (also
optional) specifies the text to be placed in the title bar of the dialog box. ”
第二个变量option是用来定义对话框的属性的,可以为
vbOKOnly
vbOKCancel
vbYesNoCancel
vbYesNo
可是answer = MsgBox(message1, 1, caption) 中第二个变量option为1,显示出来是OK+cancel的对话框(见picture 1),如果改成3,就成了yes+no+cancel的对话框(见picture 2),请问option的值为什么可以用数字表示,我又该怎么知道该数字表示的按钮形式呢?
[[it] 本帖最后由 yangn2003 于 2008-8-11 21:35 编辑 [/it]]