首页上一页 1 下一页尾页 1 条记录 1/1页
自定义确认窗口,提示有错误,运算符==无法应用于
发表在C#图书答疑
2010-09-06
是否精华
是
否
版块置顶:
是
否
frm_ok_cancel frm_ms = new frm_ok_cancel();
cls_msg.msg = "确定删除所有选中吗!";
if (frm_ms.Show() == DialogResult.OK) // [font color=#FF0000]我用的是自己定义的消息窗体,提示这句有错[/font]
//if (MessageBox.Show("确定删除所有选中吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
int m = dataGridView1.SelectedRows.Count;
String[] array = new String[m];
for (int i = 0; i < m; i++)
{
String str = this.dataGridView1.Rows[this.dataGridView1.SelectedRows[i].Index].Cells[0].Value.ToString();
String strDelete = "delete from tb_buy where _autoNum = '" + str + "'";
array[i] = strDelete;
}
//遍历数组
foreach (String str in array)
{
dbOp.getDataSet(str, "tb_buy");
}
UpdateDataGridView(); //更新数据
}
//以下是自定义确定窗体代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace IT部门管理系统
{
public partial class frm_ok_cancel : Form
{
public frm_ok_cancel()
{
InitializeComponent();
}
private void frm_ok_cancel_Load(object sender, EventArgs e)
{
label1.Text = cls_msg.msg;
}
private void button1_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void btn_cancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
}
}
cls_msg.msg = "确定删除所有选中吗!";
if (frm_ms.Show() == DialogResult.OK) // [font color=#FF0000]我用的是自己定义的消息窗体,提示这句有错[/font]
//if (MessageBox.Show("确定删除所有选中吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
int m = dataGridView1.SelectedRows.Count;
String[] array = new String[m];
for (int i = 0; i < m; i++)
{
String str = this.dataGridView1.Rows[this.dataGridView1.SelectedRows[i].Index].Cells[0].Value.ToString();
String strDelete = "delete from tb_buy where _autoNum = '" + str + "'";
array[i] = strDelete;
}
//遍历数组
foreach (String str in array)
{
dbOp.getDataSet(str, "tb_buy");
}
UpdateDataGridView(); //更新数据
}
//以下是自定义确定窗体代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace IT部门管理系统
{
public partial class frm_ok_cancel : Form
{
public frm_ok_cancel()
{
InitializeComponent();
}
private void frm_ok_cancel_Load(object sender, EventArgs e)
{
label1.Text = cls_msg.msg;
}
private void button1_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void btn_cancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
}
}