在逐个选择多个表单数据并传递给主表单时阻止form_load()事件 [英] Prevent form_load() event on selecting multiple forms data one by one and pass to main form

查看:81
本文介绍了在逐个选择多个表单数据并传递给主表单时阻止form_load()事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

i在c#中创建新的桌面应用程序。

i有三个窗体表格,第一个表格名称 - 学校详情表格

第二表格姓名 - 老师详细信息表格

第3个表格名称 - 学生详细信息表格



现在在学校详细信息表单中我为教师姓名和老师放了2个文本框城市,并在文本框附近放置1个按钮。



现在还有学校详细信息表格我为学生姓名和学生城市放了另外2个文本框,并在文本框附近放了1个按钮。



现在,当我点击按钮老师然后打开新表格,如'老师的详细信息',其中只有gridview和teachername和城市显示,现在我使用DataGridview Cell_Click事件,当我点击特定记录它移动到主学校表格。这个表格关闭。



现在我在另一个学生表格上做同样的事情,在datagrid Cell_click事件中它移动到学校详细信息页面和选定的数据在文本框中。



但问题是当我选择第一个按钮时单击它显示数据,当我点击第二个按钮时它会检索数据,但第一个数据会自动删除。



学校加载事件发生和选定的数据。

所以我怎么能停止它。并且在没有加载事件的情况下传递数据。



我尝试了什么:



hello,
i create new desktop application in c#.
i have three windows forms , 1st form name- school details form
2nd form name - teacher details form
3rd form name - student details form

now in school details form i put 2 textbox for teacher name and teacher city and put 1 button near textbox.

now also school details form i put another 2 textbox for student name and student city and put 1 button near textbox.

now here when i click button teacher then open new form like 'teacher's details' in which only gridview and teachername and city display, now I use DataGridview Cell_Click event when i click on particular record it move to main School form.and this form close.

now same thing i do on another student form , on datagrid Cell_click event it move to school details page and selected data in textbox.

but problem is when i select 1st button click it display data , and when i click 2nd button it retrive data but 1st data remove automatically.

school load event occurs and selected data.
so how can i stop that.and pass data without load event.

What I have tried:

hello,
i create new desktop application in c#.
i have three windows forms , 1st form name- school details form
                             2nd form name - teacher details form
                             3rd form name - student details form
  
now in school details form i put 2 textbox for teacher name and teacher city and put 1 button near textbox.

now also school details form i put another 2 textbox for student name and student city and put 1 button near textbox.

now here when i click button teacher then open new form like 'teacher's details' in which only gridview and teachername and city display, now I use DataGridview Cell_Click event when i click on particular record it move to main School form.and this form close.

now same thing i do on another student form , on datagrid Cell_click event it move to school details page and selected data in textbox.

but problem is when i select 1st button click it display data , and when i click 2nd button it retrive data but 1st data remove automatically.

school load event occurs and selected data.
so how can i stop that.and pass data without load event.

推荐答案

使用临时表在Sql中保存临时数据,然后在需要时获取它。让我知道是否有想法。
Use an temp table in Sql to save the temp data, then fetch it when required. Let me know if are getting the idea.


这篇关于在逐个选择多个表单数据并传递给主表单时阻止form_load()事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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