if you want the row number of the DataGrid, handle MouseUp event:private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = dataGrid1.HitTest(pt);
if(hti.Type == DataGrid.HitTestType.Cell)
{
MessageBox.Show(hti.Row.ToString());
}
}
or try
dataGrid1.CurrentRowIndexorCurrencyManager cm;
cm=(CurrencyManager)YourDataGrid.BindingContext[YourDataGrid.DataSource];
DataRowView drv;
drv =(DataRowView) cm.Current;
DataRow myDataRow = drv.Row;
{
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = dataGrid1.HitTest(pt);
if(hti.Type == DataGrid.HitTestType.Cell)
{
MessageBox.Show(hti.Row.ToString());
}
}
or try
dataGrid1.CurrentRowIndexorCurrencyManager cm;
cm=(CurrencyManager)YourDataGrid.BindingContext[YourDataGrid.DataSource];
DataRowView drv;
drv =(DataRowView) cm.Current;
DataRow myDataRow = drv.Row;
解决方案 »
- 用using System.Net.Mail怎么设置代理服务器啊
- 一个关于元搜索引擎的问题
- 测试的基本问题
- ----------------关于点击"打开"会重复打开对话框的问题-----------------
- 大家来看看
- .net c# : 在window程序运行时如何判断该程序已经在系统中运行
- 关于不同结构Sql数据库互导的思想方法
- DropDownList联动更新问题,在线等......
- AT指令怎样写如串口,怎样把执行后得到的数据取回?
- 请教大家,装了SQL Server以后再怎么装(local)\\NetSDK这个示例库啊?
- C#好还是VB#好?二者之间有何区别和联系?
- 请高手给讲一讲: .NET 技术和分布式数据管理(也就是数据库编程)的联系
通过帮定来实现:this.bindcontext(dataset).Current;