在 frmFind窗体中定义了一个函数如下:
public delegate void QueryDs(DataSet ds);
public event QueryDs QueryEvent; public void SetQuery(DataSet ds)
{
Thread thread1 = new Thread(new ParameterizedThreadStart(SetQueryThread));
thread1 .IsBackground = true;
thread1 .Start(ds);
}在另外一个类中定义了一个函数,如下:
public FrmQuery frmFind;//查询窗体
public int QueryStartID;
public int QueryEndID;
public void ReQueryData(DateTime dt, DataSet QueryData, int startid, int endid)
{
this.QueryDS = QueryData; if (startid != -1)
this.QueryStartID = startid;
if (endid != -1)
this.QueryEndID = endid;
if (this.QueryDS != null)
{
DataSet QueryDS = new DataSet(); this.frmFind.SetQuery(this.QueryDS );
}
}
运行到“ this.frmFind.SetQuery(this.QueryDS );的时候,提示“"未将对象引用设置到对象的实例"错误!!!
public delegate void QueryDs(DataSet ds);
public event QueryDs QueryEvent; public void SetQuery(DataSet ds)
{
Thread thread1 = new Thread(new ParameterizedThreadStart(SetQueryThread));
thread1 .IsBackground = true;
thread1 .Start(ds);
}在另外一个类中定义了一个函数,如下:
public FrmQuery frmFind;//查询窗体
public int QueryStartID;
public int QueryEndID;
public void ReQueryData(DateTime dt, DataSet QueryData, int startid, int endid)
{
this.QueryDS = QueryData; if (startid != -1)
this.QueryStartID = startid;
if (endid != -1)
this.QueryEndID = endid;
if (this.QueryDS != null)
{
DataSet QueryDS = new DataSet(); this.frmFind.SetQuery(this.QueryDS );
}
}
运行到“ this.frmFind.SetQuery(this.QueryDS );的时候,提示“"未将对象引用设置到对象的实例"错误!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货