Wednesday, February 19, 2014

Display Message in MessageBox in any language.

If you are working on multilingual application and you want to display message after processing of task or you want to display error information MessageBox is very important.

Here is the example which is given below:

MessageBox.Show(" Text of Any Language ");

You can convert your text message from Google translator.

Here I am display Marathi MessageBox for successful Registration.

 //Display MessageBox in Marathi Language
MessageBox.Show("नोंदणी यशस्वीरित्या पूर्ण झाले आहे.");
//Display MessageBox in Arabic Language
MessageBox.Show("ويتم التسجيل بنجاح.");
//Display MessageBox in Chinese Language.
MessageBox.Show("注册成功完成。");
//Display MessageBox in Urdu Language
MessageBox.Show("رجسٹریشن کامیابی کے ساتھ کیا جاتا ہے.");
//Display MessageBox in Tamil Language
MessageBox.Show("பதிவு வெற்றிகரமாக செய்யப்படுகிறது.");
//Display MessageBox in Telugu
MessageBox.Show("నమోదు విజయవంతంగా పూర్తయింది ఉంది.");
//Display MessageBox in Punjabi
MessageBox.Show("ਰਜਿਸਟਰੇਸ਼ਨ ਸਫਲਤਾਪੂਰਕ ਸੰਪੰਨ ਹੁੰਦੀ ਹੈ.");
//Display MessageBox in Gujrati
MessageBox.Show("નોંધણી સફળતાપૂર્વક કરવામાં આવે છે.");
//Display MessageBox in Hindi
MessageBox.Show("पंजीकरण सफलतापूर्वक किया है.");

Store login details in windows application/WPF

Introduction :

Windows application doesn't maintain any state. To store login details like user id, username, password, name etc, you can use global variable.
Store all information in global static variable which can be declare at once and you can access it any where in the program.

public static class UserDetails
    {
      public static string UserName
      {
          get;
          set;
      }
      public static string Password
      {
          get;
          set;
      }
     public static string Name
{
get;
set;
}
    }

After Login you can store all the information in these variable.
if user is validated then store information in this way which as given below.

Login code:

UserDetails.UserName=txtUserName.Text;
 UserDetails.Password=txtPassword.Text;
 //UserDetails.Name=Fetch Name from database if username and password is valid.

How to add separator to ComboBox items


<ComboBox HorizontalAlignment="Left" Margin="66,82,0,0" VerticalAlignment="Top" Width="120">
            <ComboBoxItem>Administrator</ComboBoxItem>
            <Separator></Separator>
            <ComboBoxItem>Junior Clerk</ComboBoxItem>
            <Separator></Separator>
            <ComboBoxItem>Senior Clerk</ComboBoxItem>
            <Separator></Separator>
            <ComboBoxItem>Manager</ComboBoxItem>
        </ComboBox>