Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
How to do FullColumn Selection on a DataGridView with SelectioMode set to CellSelect
Makinde A. Israel
Nov 12 2015 3:32 PM
426
Reply
Good evening.
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;
}
}
Now the problem is 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?
thanks.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
DataGridView Help needed
How to design a keypad in C#?