Running Your Code in Other Language Environments

The preceding sections explain how a locale setting determines how you, as a programmer, should enter Visual Basic code. However, the way you enter items such as dates, formats, and so on isn't always the same as what the user should see, depending on his or her locale.

At run time, Visual Basic functions usually behave as they should for the user. Visual Basic typically uses the locale settings of the operating system — not the locale settings of your Visual Basic editing environment — to determine how to interpret user-supplied numbers and dates, such as information the user enters in dialog boxes, values the user enters in cells, and so on. Visual Basic also uses these settings to determine how to display numbers and dates — such as the results of the Format function — to the user.

For example, the following two procedures are written in different languages (one in English and one in French), but they display the results in the same language when they're run on the same system. The language of the display is determined by the locale settings of the operating system. The following illustration assumes that the user has a German system with German, English, and French object libraries installed.

As a user, you might occasionally need to change your operating system locale settings to suit your needs. Or, as a programmer, you might want to change the settings to test applications you plan to distribute to others. Changing operating system locale settings will change the output of locale-aware functions and statements.

To change the locale (region) settings in Microsoft Windows

1. Click Start on the taskbar, point to Settings, and then click Control Panel.

2. Double-click the Regional Settings icon.

3. On the Regional Settings tab, click a country on the map, or click the name of a language in the list box.

The settings on the Number, Currency, Time, and Date tabs automatically change according to the language you select; however, you can also change the settings on these tabs manually.