Hello,
With the following method I retrieve the value of a specific field in a
DataGrid - it is the Id of the line of the DataGrid - The Problem is that
when I select the Id with the stylo only the the Id is marked and not the
whole line. What do I have to do that the whole line is marked when I select
one Id?
private void dgridDisplay_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
DataGrid dgridSender = (DataGrid) sender;
DataTable dtabDataSource = (DataTable)dgridSender.DataSource;
DataGridTableStyle dgtsCurrent =
dgridSender.TableStyles[dtabDataSource.TableName];
httstInfo = dgridSender.HitTest(e.X, e.Y);
try
{
string strColumnName =
dgtsCurrent.GridColumnStyles[httstInfo.Column].MappingName;
jobId = dtabDataSource.Rows[httstInfo.Row][strColumnName].ToString();
}
catch(ArgumentOutOfRangeException)
{
MessageBox.Show("Not marking a row header but a Id!");
}
catch(IndexOutOfRangeException)
{
MessageBox.Show("Not marking a column header but a Id!");
}
}
Thanks in Advance.
patrick