First Q. Hello.
Up until now I've always found previous answers to my issues. But this one is quite weird.
So I've got a Windows Forms Application that changes thread's culture with a click of a button, the application supports two languages:
Thread.CurrentThread.CurrentUICulture =CultureInfo.GetCultureInfo(someCulture);
but when the culture is changed, some of the other buttons that were supposed to show dialog boxes when clicked end up showing these boxes for a split second then closing abruptly. The key word here is some. One of the buttons still works correctly. (I have three in the form Im speaking of). For the life of me, I cannot understand what the problem is.
When switching back to the other culture it returns to operating correctly for all buttons.
The only remotely close answer I found was this ShowDialog returns immediately after a handled exception in .net compact framework When I duplicate the show dialog line it shows the dialog in the original culture twice and once in the culture with problem, but Im pretty sure there is a better way to tackle this.
Edit: I tried putting the showDialog code in a try-catch block but no exceptions were thrown.
The buttons' events handlers originally looked like this
private void someButton_Click(object sender, EventArgs e)
{
SomeForm Popup = new SomeForm();
Popup.ShowDialog();
}
After Trying out the previous questions' fix:
private void someButton_Click(object sender, EventArgs e)
{
SomeForm Popup = new SomeForm();
try
{
Popup.ShowDialog();
Popup.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show("Error occured.. " + ex);
}
}
Help, please!
First Q. Hello.
Up until now I've always found previous answers to my issues. But this one is quite weird.
So I've got a Windows Forms Application that changes thread's culture with a click of a button, the application supports two languages:
Thread.CurrentThread.CurrentUICulture =CultureInfo.GetCultureInfo(someCulture);
but when the culture is changed, some of the other buttons that were supposed to show dialog boxes when clicked end up showing these boxes for a split second then closing abruptly. The key word here is some. One of the buttons still works correctly. (I have three in the form Im speaking of). For the life of me, I cannot understand what the problem is.
When switching back to the other culture it returns to operating correctly for all buttons.
The only remotely close answer I found was this ShowDialog returns immediately after a handled exception in .net compact framework When I duplicate the show dialog line it shows the dialog in the original culture twice and once in the culture with problem, but Im pretty sure there is a better way to tackle this.
Edit: I tried putting the showDialog code in a try-catch block but no exceptions were thrown.
The buttons' events handlers originally looked like this
private void someButton_Click(object sender, EventArgs e)
{
SomeForm Popup = new SomeForm();
Popup.ShowDialog();
}
After Trying out the previous questions' fix:
private void someButton_Click(object sender, EventArgs e)
{
SomeForm Popup = new SomeForm();
try
{
Popup.ShowDialog();
Popup.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show("Error occured.. " + ex);
}
}
Help, please!
0 commentaires:
Enregistrer un commentaire