I want to globalize my application. I have created a small form which asks the user their language. I have a number of problems :
Problem 1:
In program.cs
new SplashScreen(_tempAL); new LangForm(_lang); Application.Run(new Form1(_tempAL, _lang));
I want the application not to call Form1 until the user clicks on OK in LangForm . For more explaintion in LangForm :
public LangForm(char _langChar) { InitializeComponent(); _ch = _langChar; this.TopMost = true; this.Show(); } private void _btnOk_Click(object sender, EventArgs e) { string _langStr = _cbLang.SelectedText; switch (_langStr) { case 'English': _ch = 'E'; this.Hide(); break; case 'Arabic': _ch = 'A'; this.Hide(); break; case 'Frensh': _ch ='F'; this.Hide(); break; } _pressedOk = true; } private void _btnCancel_Click(object sender, EventArgs e) { this.Close(); Application.Exit(); }
Now when I debug, the application calls LangForm and then Form1 so both forms are shown. I want Form1 to wait until the user clicks on Ok in LangForm.
Problem 2:
When should I check on the language? It’s not allowed to check in ‘initializeComponent()’ so should I check after this function and then set controls location according to the language.
Problem 3:
Within application process I displays some message so before each ‘MessageBox.Show(”);’ I should check for the language or there is another way where I may set the language once.
Problem 4:
I have searched for interfaces for MessageBox as actually I want to change its layout. How can I find templates for MessageBox?
Thanks in-advance.
Display the language selection form as a dialog. Make your Program.cs file look like this:
Add this line to your _btnOK click handler: