Click here to Skip to main content
15,743,609 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to make rpttextbox backcolor red if it less than 50 and green if it bigger than or equal 50

What I have tried:

I tried use this code
if rs ("mark) >= 50 then
report.sections ("section3").mark.backcolor=vbgreen
report.sections ("section3").mark.backcolor=vbred
end if
Updated 19-Aug-19 7:13am
CHill60 6-Aug-19 8:42am    
and what happened?
Member 14160360 6-Aug-19 10:47am    
if colum mark bigger than or equal 50 the backcolor of mark in all records well be green else the backcolor of mark in all records well be red
CHill60 6-Aug-19 19:09pm    
So your code worked. So what is your question?
Member 14160360 7-Aug-19 2:53am    
the problem is make the backcolor of mark in report green or red for all records and I want to make every record in report independent
Maciej Los 7-Aug-19 14:28pm    
What is report? A CrystalReport?

1 solution

I have found only this thread: VB Datareport Conditional Formatting - vbCity - The .NET Developer Community[^]. Here is what was stated there:

u can conditionally add some code to label control.but not to text box.bcos texbox based on the datamember and datafield.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900