关闭之前打开的表单后,从另一个表单打开表单。 [英] to open a form from another form after closing the previously open form.

查看:70
本文介绍了关闭之前打开的表单后,从另一个表单打开表单。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从另一种形式打开表单(表单已经打开)。

How can I open a form ( the form is already open) from another form.

我有一个带有grdiview控件的表单frmMain。当我点击gridview中的一个单元格时, 另一种形式'frmVehicle'将是 打开

I have a form frmMain with a grdiview control in it. When I click the one of the cell in gridview,  the another form 'frmVehicle' would be  opened

private void grvListVehicle_CellClick(object sender, DataGridViewCellEventArgs e)
        {
 frmVehicle frm = new frmVehicle(dt1);
                frm.Show();
            }

在frmVehicle中单击保存按钮事件后,应打开"frmVehicleList"表单。但如果此表单已经打开,则应该关闭 已经打开然后再打开 在frmVehicleList中获取gridview controll中车辆详细信息
的最新更改。

After the clicked event of save button in frmVehicle, the form 'frmVehicleList' should be opened. But if this form already open , it should be closed  which has been opened previously and then open again  to get latest changes in the vehicle details in gridview controll in frmVehicleList.

任何帮助都将非常感谢

Pol

polachan

推荐答案

嗨!

如果在frmVehicle中创建保存事件和frmMain中的事件处理程序怎么样?

What about create Save event in frmVehicle and event handler in frmMain?

private void vehicleForm_Save(object sender, EventArgs e)
{
   if(listForm != null)
   {
      listForm.Close();
   }

   listForm = new VehicleListForm();
   listForm.Show();
}


这篇关于关闭之前打开的表单后,从另一个表单打开表单。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆