Hi smile,
First you need to add two Resources File for English and Urdu.
In the resource file you need to give add resource key and value.
Then change the resource as per the logged in user language.
Refer below example.
In this example i have used ComboBox for selecting the language. You need to change with your login code.
Namespaces
using System.Globalization;
using System.Resources;
using System.Reflection;
Code
private void Form1_Load(object sender, EventArgs e)
{
comboBox1.Items.Add("English");
comboBox1.Items.Add("Urdu");
comboBox1.SelectedIndex = 0;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
// Get the selected language from Database based on the user loggedin.
// For this example it is checked from ComboBox selected item.
ResourceManager rm = new ResourceManager("WindowsFormsApp1.en_local", Assembly.GetExecutingAssembly());
if (comboBox1.SelectedItem.ToString() == "English")
{
rm = new ResourceManager("Multilingual.en", Assembly.GetExecutingAssembly());
}
if (comboBox1.SelectedItem.ToString() == "Urdu")
{
rm = new ResourceManager("Multilingual.ur", Assembly.GetExecutingAssembly());
}
label1.Text = rm.GetString("EmpNo");
label2.Text = rm.GetString("EmpName");
}
Screenshot