Ok, I've been asked to do this simple program where depending on the day of the week a variable is outputted to a text box. Now the example is a timetable. I have done a variables class just so I get used to it.
class Variables
{
public static string Monday = string.Format("Monday's Timetable{0}P1 English{0}P2 Maths{0}P3 History{0}P4 Computing", Environment.NewLine);
public static string Tuesday = string.Format("Tuesday's Timetable{0}P1 Science{0}P2 Geography{0}P3 History{0}P4 Maths", Environment.NewLine);
public static string Wednesday = string.Format("Wednesday's Timetable{0}P1 Science{0}P2 English{0}P3 Computing{0}P4 I.T", Environment.NewLine);
public static string Thursday = string.Format("Thurday's Timetable{0}P1 Geography{0}P2 Geography{0}P3 History{0}P4 Maths", Environment.NewLine);
public static string Friday = string.Format("Friday's Timetable{0}P1 Science{0}P2 Geography{0}P3 History{0}P4 Maths", Environment.NewLine);
}
All that is stored and I've got this in the code for the form
private void tblcustom_Click(object sender, EventArgs e)
{
string customdayofweek = customdatepicker.Value.DayOfWeek.ToString();
}
private void tbltoday_Click(object sender, EventArgs e)
{
string dayofweektoday = DateTime.Today.DayOfWeek.ToString();
outputtbl.Text = Variables. "Whatever the day of the week is"
}
The question is so I don't have to do a load of if statements, is there a way that I can do it so whatever the day of the week is selected or it is today, it will display the variable.
I hope it's clear, I can't seem to find it on the internet as well I don't really know what I'm looking for that's why I'm here
Thanks in advance
Kieran