有一个主窗体Form1,点击按钮,弹出一个窗体Form2,在Form2输入查询条件(条件有点多,所以另外开一个窗体),点击确定后Form2消失,主窗体中的treeview节点根据Form2中的条件的查询结果生成,请教高手这个怎么做呢?
我在Form2的确定按钮的单击事件里不能调用主窗体,记得delphi里面是可以直接调用的,不知道c#如何实现。
我在Form2的确定按钮的单击事件里不能调用主窗体,记得delphi里面是可以直接调用的,不知道c#如何实现。
解决方案 »
- 怎样将一个datatable中的某一列中的所有的值都加上一个字段
- ArrayList的移除问题
- 想数据保存一些程序运行时的数据,请问可以有哪些方式啊?
- URL参数最多可以指定几个?
- 放上本人做的第一个游戏俄罗斯方块,支持双人对战,乐趣多多。。
- 如何得到Toolbar中button上的text:在线等,今天结贴
- 关于DropDownList控件条件限制查询
- DataGrid中del按钮列中,调用deletecommand事件之前可否加询问窗体?
- .net 自动编译工具
- crystal report 8.5 develper edition 与 .net 里带的有什么区别?
- 初学C#,希望大家给点介意!在使用各种工具方面。
- 数据库问题 时间判断问题
Form2确定事件就调用这个类处理查询。
判断Form2返回对话框结果,Form1再调用这个类更新数据
public forms(string sql)
{
this.sql=sql;
}
然后在form2中这样写
form1 f=new form1(“查询语句,多条可以用|分割");
this.Close();
f.Show();
如果不使用模态,那么就只有自己使用线程同步数据.
{
Form2 form2 = new Form2();
if(this.comboBox1.Text=="guest")
form2.Load += new EventHandler(form2.form21_Load);
if(this.comboBox1.Text=="Adminstrator")
form2.Load += new EventHandler(form2.form22_Load);
form2.Show();
this.Hide();
}
form2:
public void form21_Load(object sender, EventArgs e)
{
//throw new Exception("The method or operation is not implemented.");
TextBox text=new TextBox();
text.Text="guest";
this.Controls.Add(text);
} public void form22_Load(object sender, EventArgs e)
{
//throw new Exception("The method or operation is not implemented.");
TextBox text = new TextBox();
text.Text = "Administrator";
this.Controls.Add(text);
}你参考下吧 我上课时候写的 但是我有一部分是申明的public 不知道是不是不好 因为我也学了才2个月