Here is an example of my code
private void OnListsCellClick(object sender, DataGridViewCellEventArgs e)
{
//This alows us to get data from the datagrid
DataGridViewCell cell = m_tab1dtgrdLists.Rows[e.RowIndex].Cells[e.ColumnIndex];
//Gets Data from Datagrid and but in members
strSelectedList = m_tab1dtgrdLists.CurrentRow.Cells[0].Value.ToString();
strListStarts = m_tab1lblListiStarts.Text = m_tab1dtgrdLists.CurrentRow.Cells[2].Value.ToString();
strListEnds = m_tab1lblListiEnds.Text = m_tab1dtgrdLists.CurrentRow.Cells[3].Value.ToString();
bWeeklist = m_tab1chckBxWeeklist.Checked =
Convert.ToBoolean(m_tab1dtgrdLists.CurrentRow.Cells[4].Value);
}
The problem is when I hit the header of the grid because the header doesn’t contain any data.Firstthought hittest right? Well that needs a mouse event but the DataGridViewCell needs the DataGridViewCellEventArgs , so I can't just switch from cellclick to mousclick. So any ideas would be good... Really lost with this one