请大家帮帮忙啊 !!!我现在急死了 ,有知道的把代码给我写一下吧!先谢谢你们了!!!
谁能给我解释一下这段代码,请详细一些~~~~
MessageBox(0,"用户名或密码错误","登录失败",0);这段代码中,各个参数表示什么意思????using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Runtime.InteropServices;
using WindowsApplication1;
namespace WindowsApplication1
{
private void button1_Click(object sender, System.EventArgs e)
{
if (textBox1.Text.Trim()=="" || textBox2.Text.Trim()=="")
MessageBox(0,"请输入用户名及密码","登录失败",0);
else
{
cn.Open();
OleDbCommand cmd=new OleDbCommand("",cn);
string sql="select RoleName from userinfo where name='"+textBox1.Text.Trim()+"' and passwd='"+textBox2.Text.Trim()+"'";
cmd.CommandText=sql;
string rolename;
if (null!=cmd.ExecuteScalar())
{
rolename=cmd.ExecuteScalar().ToString();
//隐藏登录窗口
this.Visible=false;  
//创建并打开主界面
MainForm mainfrm=new MainForm();
mainfrm.Tag=this.FindForm();
sql="select * from Roles where RoleName='"+rolename+"'";
OleDbDataReader dr;
cmd.CommandText=sql;
dr=cmd.ExecuteReader();
dr.Read();
mainfrm.menuItem16.Visible=(bool)(dr.GetValue(1));
mainfrm.menuItem10.Visible=(bool)(dr.GetValue(2));
mainfrm.menuItem1.Visible=(bool)(dr.GetValue(3));
mainfrm.menuItem2.Visible=(bool)(dr.GetValue(4));
mainfrm.menuItem3.Visible=(bool)(dr.GetValue(5));
mainfrm.menuItem4.Visible=(bool)(dr.GetValue(6));
mainfrm.statusBarPanel2.Text=textBox1.Text.Trim();
mainfrm.ShowDialog(); 
}
else
MessageBox(0,"用户名或密码错误","登录失败",0);
//dr.Close();
cn.Close();
}
}
}

解决方案 »

  1.   

    MessageBox.Show(IWinWindows owner,32string text,string caption,MessageBoxButtons buttons);  在指定对象的前面显示具有指定文本、标题和按钮的消息框!!
      

  2.   

    MessageBox(0,"用户名或密码错误","登录失败",0);
    我想知道这两个0,代表什么意思?????
      

  3.   

    消息框的用法是在Delphi中的应用
    C# MessageBox.Show
      

  4.   

    MessageBox函数MessageBox()函数MessageBox是标准的windows Api函数只能在CWnd类的继承类中使用,在C#中使用时,通常用MessageBox的show方法来实现对话框的弹出
      

  5.   

    LZ到底想问的是什么啊MessageBox的用法应该不用说吧,最开始会用的就是Console.Write()和MessageBox.Show()
      

  6.   


    最简单就这么写MessageBox.Show("要显示的文本", "标题", MessageBoxButtons.OK);
    //或
    MessageBox.Show("要显示的文本");
      

  7.   

    http://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox.show(VS.71).aspx
    //MSDN   
    private void validateUserEntry2()
        {        // Checks the value of the text.        if(serverName.Text.Length == 0)
            {            // Initializes the variables to pass to the MessageBox.Show method.            string message = "You did not enter a server name. Cancel this operation?";
                string caption = "No Server Name Specified";
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                DialogResult result;            // Displays the MessageBox.            result = MessageBox.Show(this, message, caption, buttons,
                    MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, 
                    MessageBoxOptions.RightAlign);            if(result == DialogResult.Yes)
                {                // Closes the parent form.                this.Close();            }        }
      

  8.   

    请问楼上发的代码是干嘛用的??怎么没人告诉我 怎样将Excel中的内容导入DataGrid中呢?????帮帮我吧!!
      

  9.   

    C#读取Excel到datagridview
      

  10.   

    请问楼上的,DataGrid与DataGridView  两个是一样的吗?代码能通用吗?
      

  11.   

    。我是问了两个问题 第一个是Excel导入DataGrid,第二个是MessageBox(0,"用户名或密码错误","登录失败",0);中两个0代表什么意思。两个问题都想知道答案啊  !第一个最好把代码给我看看啊 谢谢各位了!!!!