修改子窗体的构造函数(或添加一个构造函数),添加一个DataGrid参数,然后在父窗体中实例化子窗体的时候将DataGrid作为参数传递给子窗体。
解决方案 »
- c#.net发布程序出现错误
- sqldatareader 对象,如何在打开前判断是否已经打开,已打开,就不能执行
- 水果落地游戏
- system.data.datatable 中的 newrow()方法是怎么实现的?
- c# oledb add添加数据到数据库,参数未声明
- 原样显示扫描后的图片问题!只要有点点主意的朋友都进来看看吧 ,救命啊...
- ~~这个打印问题好像还没人能解决!~~
- 关于Microsoft Commerce Server 2002中虚拟目录的一个问题!
- 运socket的service端的Startlisteining()报错:
- 如果客户用xp home的话,运行NET编的软件,除了安装Framework net2.0 还要装些什么
- 如何得到网卡的IP地址?
- 求源代码!求求各位了!
子窗体中:
((ParentForm)this.parent).datagrid1...
子窗体中是在private void Form2_Load函数中设吗?我是小菜鸟,谢谢答复
子窗体中是在private void Form2_Load函数中设吗?我是小菜鸟,谢谢答复
==========================================================
在设计视图中选datagrid,属性中的Modifiers属性从private改为public。
或者在代码中改:类构造函数的上边的datagrid声明处,由private改为public。
==========================================================
子窗体中要引用datagrid的地方用((ParentForm)this.parent).datagrid1
private void AdvSer_Click(object sender, System.EventArgs e)
{
if(StateSearchFrm==false)//判断是否有Search实例
{
Search f=new Search(this);
f.Show();
} }这是自窗口的查询按钮
private void Seachbtn_Click(object sender, System.EventArgs e)
{
想在这里引用DataGrid,DataSet,DataAdapter,DataConnection再查询,就是不能引用请帮忙,在父窗口里面我已经设成Public了,为什么呀?
}
public Commitee.CMDataSet cmDataSet;
private System.Windows.Forms.Label Posisionlbl;
private System.Windows.Forms.Label Statelbl;
private System.Windows.Forms.Label Clanlbl;
private System.Windows.Forms.Label Schoolarshiplbl;
private System.Windows.Forms.Label Workspacelbl;
private System.Windows.Forms.Label Unitaddresslbl;
private System.Windows.Forms.Label Unitphonelbl;
private System.Windows.Forms.Label Unitcodelbl;
private System.Windows.Forms.TextBox Statetxt;
private System.Windows.Forms.TextBox Clantxt;
private System.Windows.Forms.TextBox Schoolarshiptxt;
private System.Windows.Forms.TextBox Workspacetxt;
public System.Windows.Forms.TextBox Unitaddresstxt;
private System.Windows.Forms.TextBox Unitphonetxt;
private System.Windows.Forms.TextBox Unitpostcodetxt;
private System.Windows.Forms.Label Memolbl;
private System.Windows.Forms.TextBox Memotxt;
private System.Windows.Forms.Label Grouplbl;
private System.Windows.Forms.TextBox Grouptxt;
private System.Windows.Forms.TextBox IsSCtxt;
private System.Windows.Forms.Label IsSClbl;
private System.Windows.Forms.TextBox Homeaddresstxt;
private System.Windows.Forms.Label Homeadresslbl;
private System.Windows.Forms.La
这是部分代码