关于MessageBox.Show("!
private void button1_Click(object sender, System.EventArgs e)
{
try
{
openFileDialog1.ShowDialog();
oledbconn1.ConnectionString="provider=Microsoft.Jet.OLEDB.4.0;data source="+openFileDialog1.FileName+";Extended Properties=Excel 8.0;Persist Security Info=False";
oledbconn1.Open();
MessageBox.Show("打开成功!","提示!",MessageBoxButtons.OK,MessageBoxIcon.Information );
}
catch(OleDbException oe)
{
//Console.Write(oe.Message);
MessageBox.Show("Excel文件没有被打开!" ,"错误",MessageBoxButtons.OK,MessageBoxIcon.Error );
}
}
原意:用oledbconnstrion控件打开EXCEL文件,如何能正确打开则弹出一个提示框,如何打开错误的话,则想显示自动捕捉的错误信息即oe.Message,但不知MessageBox.Show里怎么设置,只好用“Excel文件没有被打开!”来代替,请哪位大侠帮助看看该如何填写MessageBox.show里的参数,多谢!