Tag Archives: C#

How to convert the Month Number to Month Name in C#

The following code will help if you have a need to convert the month number such as 3 to the month name like March.


//the following line of code will convert the month number to month name
string sMonthName = DateTime.Today.ToString(“MMM”);

// the following line of code will give you the Month Name and the Year
this.btnOne.Content = sFirstMonth + “-” + DateTime.Today.Year.ToString();


See the video below to see the working of the code live.

How to open second window from first window in wpf in C#?

This is how you would open a second window in WPF.

private void btnAppointmentPage_Click(object sender, RoutedEventArgs e)


//In this example we have already created a WPF Window and called
//it AppointmentsMain.xaml

AppointmentsMain AppointmentWindow = newAppointmentsMain();