Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I use my windows language by default of my vb.net software?

I am student and I am working on my own project.

I use two languages in my project one, is English and second is Urdu.

When my vb.net form load the default language is English and I have set language id to Urdu.
I want to use my second language as a default when my project starts.

And I also want to have the option to select the language from a combobox, select one and that becomes the default language.

I think there is use registry key as I have a project in vb.net which is working of one and off of fire wall of windows code is give bellow


VB
Imports System
Imports Microsoft.Win32
Public Class Form1
    Private regkey As RegistryKey
    Private ret_v As Byte

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        regkey = Registry.LocalMachine.OpenSubKey("SYSTEM\currentControlSet\Services\SharedAccess\Parameters\FirewaLLpolicy\Standardprofile", False)
        ret_v = regkey.GetValue("EnableFirewall")
        If ret_v = 1 Then
            RadioButton1.Checked = True
        Else
            RadioButton2.Checked = True
        End If
        regkey.Flush()
        regkey.Close()

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        regkey = Registry.LocalMachine.OpenSubKey("SYSTEM\currentControlSet\Services\SharedAccess\Parameters\FirewaLLpolicy\Standardprofile", True)
        regkey.SetValue("EnableFirewall", ret_v, RegistryValueKind.DWord)


        regkey.Flush()
        regkey.Close()
        MsgBox("SUCCESSFULL APPLIED", MsgBoxStyle.Information, Me.Text)

    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        If RadioButton1.Checked = True Then
            ret_v = 1
        End If
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        If RadioButton2.Checked = True Then
            ret_v = 0
        End If
    End Sub
End Class

Please tell me any one about my project as I asked or I want to use please tell me
Posted
Updated 26-Oct-10 21:41pm
v3
Comments
Dalek Dave 27-Oct-10 3:42am    
Edited for Grammar and Syntax. Tidied up Code Block. I also rejigged the question to make better sense.
I understood what you were after, but for people whose first language wasn't English it would have been very difficult to understand.

1 solution

You need to use Localization here is an article on Code Project:

http://www.codeproject.com/KB/dotnet/Localization.aspx[^]

In gerenal you need to create resource files to contain the GUI text. You will have a base file (for the "base" invariant culture) and a file for each culture you want alternative text for. So for example

MyForm.resx --> Invariant Culture
MyForm.Ar.resx --> General Arabic Version
MyForm.Ar-JO.resx --> Jordanian Arabic Version
MyForm.Ar-SA.resx --> Saudi Arabic Version

(Aplogies, I don't know which culture Urdu Belongs to, I am currently writing bilingual Arabic/English websites.)

You should then change the UICulture of the application that is running, and this will apply the matching resource (or use the Invariant language if not found). Note that the resx filename must must match the culture code properly. The specifics of doing this are in the rticle.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900