|
-
Dec 13th, 2004, 10:24 AM
#1
Thread Starter
Frenzied Member
changing text in a selected row in a datagrid
Hello,
I have a datagrid with books, when the book is overdue i want it to change the text to Red. A for has been used to go through each row (works fine). But when it comes to a book that is overdue, l want it to change the text to red. I have tired using the code below, but does not work.
<code>if ( dateDue < todaysDate )
{
grdBookOnLoan.Select(i); //i For loop counter
grdBookOnLoan.ForeColor = Color.Red;
grdBookOnLoan.UnSelect(i);
}</code>
Thanks in advance,
Steve
-
Dec 13th, 2004, 11:23 AM
#2
Banned
Re: changing text in a selected row in a datagrid
 Originally Posted by steve_rm
Hello,
I have a datagrid with books, when the book is overdue i want it to change the text to Red. A for has been used to go through each row (works fine). But when it comes to a book that is overdue, l want it to change the text to red. I have tired using the code below, but does not work.
<code>if ( dateDue < todaysDate )
{
grdBookOnLoan.Select(i); //i For loop counter
grdBookOnLoan.ForeColor = Color.Red;
grdBookOnLoan.UnSelect(i);
}</code>
Thanks in advance,
Steve
Steve,
No offense to you, but if you are looping through each row, you're doing it the wrong way. Your db backend (if it's sql) should allow you to return rows based on specific criteria, that criteria being overdue books or what not. When you have the resultant of returned rows you know these are the "overdue" entries. So why are you ever looping through every row to make some text red ?
-
Dec 14th, 2004, 06:27 AM
#3
Thread Starter
Frenzied Member
Re: changing text in a selected row in a datagrid
Thanks for the reply.
What my system does is, it lists all the books that the user has booked out, and displays only the rows in red where they are overdue. I have a loop that checks if the books are overdue (this works fine), but the problem is, when it finds a row with an overdue book, l don't know how to make the text in that row red. This is so that the admin staff can see more clearly the books that the user has and the ones that are overdue.
Hope this make everything more understandable.
I thought this would be an easy problem to solve.
Thanks for your help in advance,
Steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|