用下列方法引用表格中的单元格.
datagrid[datagrid.CurrentRowIndex,0];
datagrid[datagrid.CurrentRowIndex,1];
datagrid[datagrid.CurrentRowIndex,2];
datagrid[datagrid.CurrentRowIndex,0];
datagrid[datagrid.CurrentRowIndex,1];
datagrid[datagrid.CurrentRowIndex,2];
解决方案 »
- 求助:想通过HttpListener方法监听到本机所有端口 65535个
- c# 用Lable显示读取到的SQL数据
- 谁知道这句代码啥意思?
- winform如何自定义界面的标题栏??
- 在vs 2005中怎么取得app.config中connectionStrings的值??
- 请问C# 中客户端和服务器进行交互,并且客户向服务器传文件。。。
- 100分求像超市中扫描条形码的程序,如何获取扫描得到的数据
- 用SharpZipLib给文件压缩时,加上的密码,但是在解压时出错,请高手指点
- 求C#贪吃蛇游戏源程序
- SQL的存储过程问题,高手请~~~~~~~
- 帮忙看一下,一段小代码,简单,50分全送!
- 关于graphics的重绘问题!(答对马上结帖,帮顶者也有分)
System.Windows.Forms.DataGrid.HitTestInfo hti;
hti = myGrid.HitTest(e.X, e.Y);
if(hti.Type == System.Windows.Forms.DataGrid.HitTestType.Cell || hti.Type==System.Windows.Forms.DataGrid.HitTestType.RowHeader)
{//判断点击的类型,是否为单元格,此例中我选择获取开始的三个单元格的内容,根据hti.row的值确定单击的行
myGrid.CurrentCell = new DataGridCell(hti.Row,0);
textBox1.Text = dataGrid1[dataGrid1.CurrentCell].ToString();
myGrid.CurrentCell = new DataGridCell(hti.Row,1);
textBox2.Text = dataGrid1[dataGrid1.CurrentCell].ToString();
myGrid.CurrentCell = new DataGridCell(hti.Row,2);
textBox3.Text = dataGrid1[dataGrid1.CurrentCell].ToString();
}