| Changing
the color according to the state |
|
In this report we change the color
according to the state by using OnRow method.
|
|
Description
|
|
We can done this report by Overriding the OnRow method. This event triggers when a new row is created. This is the method of
AcReportComponent. This class is the base class for sections, pages, frames, and controls.
|
 |
First of all create a simple report with one frame. |
 |
also connection and a SQL component.
|
 |
Select name, id and State from customer table.
|
 |
Place components in the frame to display all selected fields.
|
 |
Select a text control and insert the remaining after the supper classes
OnRow method
|
|
Select Case row.GetValue("AddrCity")
Case
"New York"
Font.Color=Red
Case "Florida"
Font.Color=Cyan
Case
"Pune"
Font.Color=Forest
End Select
|
 |
The code then changes the color according to its
value
|
|
|
|
Select
case statement is the “Case” clause used in all
programming languages. The syntax is as follows
Select Case <compare to this>
[Case <value to compare> [, <value to
compare>]...
[<statement block 1>]]
[Case <value to compare> [, <value to compare>]...
[<statement block 2>]]
[Case Else
[<statement block n>]]
End Select
|
|
As you can see from the syntax, you can give more than one value to compare with Case statement. This is done by separating values by a ‘,’(coma). We can also give a range in case statement. This is done using ‘To’ keyword. The Select Case is ended with ‘End Select’ statement. We even can use a ‘Case Else’ statement, which is done as the default statements. The end of statement block is determined by the occurrence of next Case or End Case.
|
|
|
|
|
|
|