imports system.windows.formsprivate sub button1_click()     dim str as boolean
     '执行程序
     
     if str=true then
       
        if MessageBox.Show("nihao", "hao", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)=DialogResult.OK then
        '执行代码
       else
         '执行代码
       end if
     else
     
      '执行代码
end if
end sub

解决方案 »

  1.   

    TO:dattotzy(酋长) 
    你理解错了我的意思,你的对话框是在服务器端出现,我要求的是客户端出现
      

  2.   

    对,是要webform的,winform没什么难度
      

  3.   

    CSDN上有控件下载吗,LoveAlien能否给个URL
      

  4.   

    http://www.csdn.net/cnshare/soft/17/17684.shtm
      

  5.   

    可以,但是做起来麻烦一些,暂时的思路.....还不知道是否能实现,试试.....aspx页面中的控件:
    TextBox:   ID=TextBox1  AutoPostBack="True" 设置TextChanged事件
    Button:     ID=Button1   设置Click事件.cs中写上面两个控件的事件
    this.Button1.Click += new System.EventHandler(this.Button1_Click);
    this.TextBox1.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
    ..........
    private void Button1_Click(object sender, System.EventArgs e)
    {
    定义一个变量
        服务器端执行一段程序
    判断变量的值 
    if(true)
    {
      if(TextBox1.Text.Trim()=="")
      {
        Page.RegisterStartupScript("Javascript","<Script Language=JavaScript>var del_info=window.confirm(\"确定要删除这条信息?\");if(del_info == null||del_info == \"\"){return false;}else{document.all.item(\"TextBox1\").value=\"True\"}</Script>");
      }
      else if(TextBox1.Text.Trim()=="True")//单击确定
      {
        服务器执行一段代码
      }
      else
      {
        服务器执行另一段代码
      }
    }
    }private void TextBox1_TextChanged(object sender, System.EventArgs e)
    {
    Button1_Click(sender,e)
    }