'Declaration Public Event QueryVariableText As QueryVariableTextEventHandler
'Usage Dim instance As Report Dim handler As QueryVariableTextEventHandler AddHandler instance.QueryVariableText, handler
public event QueryVariableTextEventHandler QueryVariableText
Event Data
The event handler receives an argument of type QueryVariableTextEventArgs containing data related to this event. The following QueryVariableTextEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Format | Gets the value of the variable's "format" parameter. |
FormatProvider | Gets the Format Provider that will be used to format the string representation of the variable. |
PageNumber | Gets the current page number. |
TotalPageNumber | Gets the total number of pages in the report. |
VariableName | Gets the name of the variable. |
VariableText | Gets or sets the string representation of the variable. |
Remarks
If String.Compare(e.VariableName, "EvenPage", True, System.Globalization.CultureInfo.InvariantCulture) = 0 Then
If e.PageNumber Mod 2 = 0 Then
Dim formatProvider As IFormatProvider = e.FormatProvider
Dim format As String = e.Format
If formatProvider Is Nothing Then
formatProvider = System.Globalization.CultureInfo.CurrentCulture.NumberFormat
End If
If format.Length = 0 Then
format = "g"
End If
e.VariableText = String.Format(formatProvider, "{0:" + format + "}", e.PageNumber)
End If
Else
If String.Compare(e.VariableName, "OddPage", True) = 0 Then
If e.PageNumber Mod 2 = 1 Then
Dim formatProvider As IFormatProvider = e.FormatProvider
Dim format As String = e.Format
If formatProvider Is Nothing Then
formatProvider = System.Globalization.CultureInfo.CurrentCulture.NumberFormat
End If
If format.Length = 0 Then
format = "g"
End If
e.VariableText = String.Format(formatProvider, "{0:" + format + "}", e.PageNumber)
End If
End If
End If
if( string.Compare( e.VariableName, "EvenPage", true, System.Globalization.CultureInfo.InvariantCulture ) == 0 )
{
if( e.PageNumber 2 == 0 )
{
IFormatProvider formatProvider = e.FormatProvider;
string format = e.Format;
if( formatProvider == null )
formatProvider = System.Globalization.CultureInfo.CurrentCulture.NumberFormat;
if( format.Length == 0 )
format = "g";
e.VariableText = string.Format( formatProvider, "{0 2 == 1 )
{
IFormatProvider formatProvider = e.FormatProvider;
string format = e.Format;
if( formatProvider == null )
formatProvider = System.Globalization.CultureInfo.CurrentCulture.NumberFormat;
if( format.Length == 0 )
format = "g";
e.VariableText = string.Format( formatProvider, "{0:" + format + "}", e.PageNumber );
}
}
The DATETIME variable will only be evaluated once at the beginning. All other variables will be evaulated for each page.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also