Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleLocalize control resources in VB .NET
DescriptionThis example shows how to Localize control resources in VB .NET. The program uses the form's Localizable and Language properties. This example also shows how to change the language when a form loads.
Keywordslocale, internationalization, globalization, CultureInfo
CategoriesVB.NET, Controls
 
First, build the form as you normally would. Then set the form's Localizable property to True and set its Language property to another language that you want to support. Change the controls' properties for the new language. For example, translate the text into the new language.

When you do this, Visual Basic stores information for the different languages in different resource files associated with the form. If you click the Solution Explorer's Show All Files button, you can see these files below the form.

Normally Visual Basic examines the copmuter's regional settings to decide which resources to use but you can change this for testing purposes. Open the form's "Windows Form Designer generated code" section and find the form's New subroutine. Before the call to InitializeComponent, set the Thread.CurrentThread object's CurrentCulture and CurrentUICulture properties to a CultureInfo object that selects the language you want to use.

 
Public Sub New()
    MyBase.New()

    ' Set the culture and UI culture before 
    ' the call to InitializeComponent.
    'Thread.CurrentThread.CurrentCulture = New
    ' CultureInfo("de-DE")
    'Thread.CurrentThread.CurrentUICulture = New
    ' CultureInfo("de-DE")

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent()
    ' call

End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated