Good morning.
I am working on a winForm where I need to use DataGridView control to display data read from a user supplied txt file with no pre-knowledge of how it is formatted but using delimiters which will be supplied by the user(students). I set the datagridview's (dgView) SelectionMode to CellSelect and handle the ColumnHeaders_MouseClick event to provide the option for fullColumn Select as shown below:
private void dgView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
for each(DataGridViewRow row in dgView.Rows
{
dgView. Columns[e.ColumnIndex].Selected = true;
}
}
The Now thebis that when I check the dgView. SelectedColumns.Count it gives me zero(0) meaning that no Column was selected. please how do I get around this I need the SelectedColumn.Count to know how many columns was selected.
Loading


Dorababu MekaRank #457 · 5.5K reputationPosted Nov 18, 2015, 7:58 AM EST
Makinde A. Israel150 reputationPosted Nov 18, 2015, 8:38 AM EST
I will do that but the problem was that after looping through all the rows and setting the Selected property of all the cells at the Column index to true,
dgView.SelectedColumns returned zero (0).
what could be wrong?
Makinde A. Israel150 reputationPosted Nov 18, 2015, 8:49 AM EST
I will do that but the problem was that after looping through all the rows and setting the Selected property of all the cells at the Column index to true,
dgView.SelectedColumns.Count returned zero (0).
what could be wrong?
Dorababu MekaRank #457 · 5.5K reputationPosted Nov 21, 2015, 7:06 AM EST