datagrid没有数据时程序crash的问题 winform的程序我用SqlDataAdapter读取数据,然后通过datatable填充到datagrid里,当没有记录的时候,只要一点datagrid,就会自动关闭。提示“其他信息:无法从未绑定到 DataTable 的 DataGrid 中读取数据。”请问怎么解决? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的datagrid的click事件、mousedown或mouseup事件,对datagrid做什么处理了,是那里的问题 mouseup做过处理,为了解决选择框的问题那应该怎么改呢?this.dg_InfoLesson.MouseUp += new System.Windows.Forms.MouseEventHandler(this.DataGridMouseUp);private void DataGridMouseUp(object sender, System.Windows.Forms.MouseEventArgs e){ if(this.dg_InfoLesson.CurrentCell.ColumnNumber != 0) { return; } if(this.dg_InfoLesson[Convert.ToInt32(this.dg_InfoLesson.CurrentCell.RowNumber),0].ToString() == "False") { this.dg_InfoLesson[Convert.ToInt32(this.dg_InfoLesson.CurrentCell.RowNumber),0] = true; } else if(this.dg_InfoLesson[Convert.ToInt32(this.dg_InfoLesson.CurrentCell.RowNumber),0].ToString() == "True") { this.dg_InfoLesson[Convert.ToInt32(this.dg_InfoLesson.CurrentCell.RowNumber),0] = false; }} 搞定了判断一下datagrid的数据源是不是为空就行了 请教:应该使用何种技术 DesignMode无效??? Remoting 做压力测试的时候,为什么报出信道 tcp 已注册的错误 如何将 Button 的标签设置为 “确定”? VISIO2007数据库建模后怎么导出sql文件 cs结构的程序,把数据库放到一台机子上,程序放另一台机子上。能在安装时直接把数据库指到远程数据库吗??? 在点对点模式下外网与内网通信时的地址转换(NAT)问题 C#中多窗体访问serialport 求教: 在2003上安装完VS.NET后,不能建WEB应用程 如何在C#中将一个web页面转换为txt文本 自定义控件(TextBox) 日期怎么会在后面显示12:00
那应该怎么改呢?this.dg_InfoLesson.MouseUp += new System.Windows.Forms.MouseEventHandler(this.DataGridMouseUp);private void DataGridMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(this.dg_InfoLesson.CurrentCell.ColumnNumber != 0)
{
return;
}
if(this.dg_InfoLesson[Convert.ToInt32(this.dg_InfoLesson.CurrentCell.RowNumber),0].ToString() == "False")
{
this.dg_InfoLesson[Convert.ToInt32(this.dg_InfoLesson.CurrentCell.RowNumber),0] = true;
}
else if(this.dg_InfoLesson[Convert.ToInt32(this.dg_InfoLesson.CurrentCell.RowNumber),0].ToString() == "True")
{
this.dg_InfoLesson[Convert.ToInt32(this.dg_InfoLesson.CurrentCell.RowNumber),0] = false;
}
}