Title Case in c# Winforms.

Posted by Peermohamedmydeen under C# category on | Points: 40 | Views : 3913
Hello All,

The below code will be useful when we need to change the text to title case in C# winforms.

Here we are using CultureInfo and TextInfo classes from Globalization Namesapce.

public static string ToTitleCase(string mText)
mText = mText.ToLower();
string rtext = string.Empty;

System.Globalization.CultureInfo cultureinfo = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Globalization.TextInfo textinfo = cultureinfo.TextInfo;
rText = TextInfo.ToTitleCase(mText);

rText = mText;

return rText;

I hope it will be helpful.

PMM :)

Comments or Responses

Login to post response