| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1388 人关注过本帖
标题:关于Msgbox的问题
只看楼主 加入收藏
yangn2003
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2008-8-11
收藏
 问题点数:0 回复次数:1 
关于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]]
搜索更多相关主题的帖子: Msbox System ByVal Dim Object 
2008-08-11 19:26
jonebob
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2008-7-17
收藏
得分:0 
查帮助文档,里面有
2008-08-11 23:51
快速回复:关于Msgbox的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017005 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved