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
Eline Sami
NA
47
70.4k
Sort the datagridview based on a cell value
May 4 2015 12:12 AM
Hi Vulupes and Ishan
in DatagridView (not bound to DB), would like to sort rows based on the priority of the row.
I have one method that change the fontcolor of row based on the priority
//Part of method///
if((row.cells[0].value).toString()=="High")
{
row.DefaultCellStyle.ForeColor = System.Drawing.Color.Red;
}
but I want all the rows that have red fontcolor to be displayed on the top of the list. In other words, if I set or change the importance of row to "high" then the row will be displayed automatically to the top of the list.
I have one method for sorting, but it doesn't work as I want:
private void SortRows()
{
dgv.Sort(dgv.Columns[0], ListSortDirection.Descending);
}
Reply
Answers (
4
)
how to validate a textbox with only numeric input.
Classes and methods arrangements along arrays