Monday, April 20, 2009

Tips of the day

I was asked about this question on one of my interview, how to change the language of the message box in the window application. I do not know how to answer that question but googled it and found this.

using System;
using System.Windows.Forms;

namespace OpenDental
{
///This is a more efficient version of the MS MessageBox.
public class MsgBox
{


///This is a more efficient version of the MS MessageBox. It also automates the language translation. Do NOT use if the text is variable in any way, because it will mess up the translation feature.
public static void Show(System.Object sender,string text){
MessageBox.Show(Lan.g(sender.GetType().Name,text));
}

///This is a more efficient version of the MS MessageBox. It also automates the language translation. Will show okCancel regardless if you set it to true or false, so always use true.
public static bool Show(System.Object sender,bool okCancel,string question){
if(MessageBox.Show(Lan.g(sender.GetType().Name,question),"",MessageBoxButtons.OKCancel)
==DialogResult.OK)
{
return true;
}
else{
return false;
}

}

}
}

No comments:

About Me

A normal person, who live today to die tommorow