Get all the fonts installed on the system

Import System.Drawing.Text namespace

using System.Drawing.Text;

Add a DropDownList and change its name to ListAllFont and write this below code on Form’s load event handler.

private void Form1_Load (object sender, System.EventArgs e)
{
InstalledFontCollection fonts = new InstalledFontCollection();
foreach (FontFamily font in fonts.Families)
    //ListAllFont is ListBox
    ListAllFont.Items.Add(font.Name);
}

String Manipulation in C#

Trim Function
The trim function has three variations Trim, TrimStart and TrimEnd. The first example show how to use the Trim(). It strips all white spaces from both the start and end of the string.

//STRIPS WHITE SPACES FROM BOTH START + FINSIHE
string Name = " String Manipulation " ;
string NewName = Name.Trim();
//ADD BRACKET SO YOU CAN SEE TRIM HAS WORKED
MessageBox.Show("["+ NewName + "]");

Continue reading String Manipulation in C#