In a report, the Report object, TextBox control, and Chart control have a public Culture property that allows you to localize data when the OutputFormat property is set to D (date), C (currency), or other .NET formats.
![](images/hs-note.gif) |
Note: The default value for the Culture property is (default, inherit). For the Report object, this is the culture of the current thread and for the TextBox control and the ChartControl, this is the culture of the Report object. |
In a report, the Report object, TextBox control, and Chart control all have a Language property that works in the same way. The default value for the Language property is Default, which is the culture of the current thread.
Design Time
At design time, you can set the culture or language in the Visual Studio Properties window.
To localize a Report at design time
- Click the gray area around the to select the Report in the Properties window.
- In the Properties window, drop down the Culture or Language property and select the culture that you want to apply to the report.
To localize a TextBox control at design time
- Click the TextBox control that you want to localize to select it.
- In the Properties window, drop down the Culture or Language property and select the culture that you want to apply to the textbox.
To localize a Chart control at design time
- Click the Chart control to select it.
- In the Properties window, drop down the Culture or Language property and select the culture that you want to apply to the chart.
Run Time
You can also specify a culture in code for section reports. For a list of System.Globalization culture codes, see Cultures.
To localize a Report at run time
- Double-click the gray area around the , to create an event handling method for the ReportStart event.
- In the code view of the report that appears, paste code like the following.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the ReportStart event. |
Copy Code
|
YourReportName.Culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US") |
To write the code in C#
C# code. Paste INSIDE the ReportStart event. |
Copy Code
|
YourReportName.Culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); |
To localize a TextBox at run time
- On the , double-click the section containing the TextBox control that you want to localize to create an event handling method for the section Format event.
- In the code view of the report that appears, paste code like the following inside the Format event.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Format event. |
Copy Code
|
TextBox.Culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US") |
To write the code in C#
C# code. Paste INSIDE the Format event. |
Copy Code
|
textBox.Culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); |
To localize a Chart at run time
- On the , double-click the section containing the ChartControl that you want to localize to create an event handling method for the section Format event.
- In the code view of the report that appears, paste code like the following in the Format event.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the Format event. |
Copy Code
|
ChartControl.Culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US") |
To write the code in C#
C# code. Paste INSIDE the Format event. |
Copy Code
|
chartControl.Culture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); |
See Also