求C#高手解答急~~
protectedCurrencyManagercmOrders;protectedvoidtoolBar1_ButtonClick(objectsender,Syste...
protected CurrencyManager cmOrders;
protected void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if (e.Button.ToolTipText == "退出")
{
this.Close();
}
if(e.Button.ToolTipText=="首记录")
{
int i=Convert.ToInt32(cmOrders.Position);
this.dataGrid1.UnSelect(i);
this.dataGrid1.UnSelect(cmOrders.Position );
cmOrders.Position = 0;
this.dataGrid1.Select(cmOrders.Position);
this.dataGrid1.CurrentRowIndex = cmOrders.Position;
return;
}
}
编译时出现错误”未将对象引用设置到对象的实例。“int i=Convert.ToInt32(cmOrders.Position);这一行 展开
protected void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if (e.Button.ToolTipText == "退出")
{
this.Close();
}
if(e.Button.ToolTipText=="首记录")
{
int i=Convert.ToInt32(cmOrders.Position);
this.dataGrid1.UnSelect(i);
this.dataGrid1.UnSelect(cmOrders.Position );
cmOrders.Position = 0;
this.dataGrid1.Select(cmOrders.Position);
this.dataGrid1.CurrentRowIndex = cmOrders.Position;
return;
}
}
编译时出现错误”未将对象引用设置到对象的实例。“int i=Convert.ToInt32(cmOrders.Position);这一行 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询