日期:2014-05-18 浏览次数:20964 次
//我要调用这个事件 
//B窗体的事件
private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确认删除该品牌?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel)
            {
                return;
            }
            ProductMgr productMgr = new ProductMgr();
            int productID = int.Parse(dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value.ToString());
            int result = productMgr.DeleteProductInfo(productID);
            if (result > 0)
            {
                MessageBox.Show("删除商品信息成功!");
                dataGridView1.Rows.RemoveAt(dataGridView1.CurrentCell.RowIndex);
                loadProductCategory();
                if (LoadDate.productCategoryDataSet != null && LoadDate.productCategoryDataSet.Tables.Count > 0)
                    dataGridView1.DataSource = LoadDate.productDataSet.Tables[0];
            }
            else
            {
                MessageBox.Show("删除商品信息失败!", TooltipInfo.validatInfo());
            }
        }
//我要在A窗体的button。click事件里调用上面的
private void button17_Click(object sender, EventArgs e)
        {
            //如何在这里面调用B窗体的那个事件
        }
public void Form1_Load()
{
public void delegate tempDelegate(object obj);//可以自己定义想要传的参数,如果是对象可以用object
public tempDelegate MyDelegate;
}
------解决方案--------------------
对了,这段可以去掉了。点button17(上面我写错了,写成button7了)直接响应绑定的DeleteToolStripMenuItem_Click了。
private void button17_Click(object sender, EventArgs e)
        {
            //如何在这里面调用B窗体的那个事件
        }