TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Makinde A. Israel
1.6k
168
20.7k
How to do FullColumn Selection on a DataGridView with SelectioMode set to CellSelect
Nov 6 2015 2:02 AM
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.
Reply
Answers (
4
)
How to read file and dispose streamReader object?
how to send Email through my Own Domain