F
finleeds
hi all
I m using the visual studio designer to create 1 Dataset with 1 table
with 3 columns : Id, Name, Birthday.
Once this done, still with the designer, I m creating a datagridview
and choose my dataset as DataSource.
magic : the columns appear in the datagridview.
Still with the designer, I can change the properties of the fist column
"Id" to hide it.
now it s time to write some code :
on the cellClick event I want to get the value of the Id, unfortunaly
it throws an exception cause the column is hided
DataGridViewRow row =
(DataGridViewRow)dataGridView.Rows[e.RowIndex];
if (row != null)
{
try
{
this.selectedRowIndex =
(int)row.Cells["Id"].Value;
}
catch
{
int a = 1;
}
}
Does anyone know how to get the value of a hiding column when the user
clics on a row ?
thx for your help
ben
I m using the visual studio designer to create 1 Dataset with 1 table
with 3 columns : Id, Name, Birthday.
Once this done, still with the designer, I m creating a datagridview
and choose my dataset as DataSource.
magic : the columns appear in the datagridview.
Still with the designer, I can change the properties of the fist column
"Id" to hide it.
now it s time to write some code :
on the cellClick event I want to get the value of the Id, unfortunaly
it throws an exception cause the column is hided
DataGridViewRow row =
(DataGridViewRow)dataGridView.Rows[e.RowIndex];
if (row != null)
{
try
{
this.selectedRowIndex =
(int)row.Cells["Id"].Value;
}
catch
{
int a = 1;
}
}
Does anyone know how to get the value of a hiding column when the user
clics on a row ?
thx for your help
ben