namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btCheckDay_Click(object sender, EventArgs e)
{
int day = (int)DateTime.Now.DayOfWeek;
switch (day)
{
case 0:
MessageBox.Show("Today is Sunday", DateTime.Now.ToShortDateString());
this.BackColor = Color.Red;
break;
case 1:
MessageBox.Show("Today is Monday", DateTime.Now.ToShortDateString());
this.BackColor = Color.Yellow;
break;
case 2:
MessageBox.Show("Today is Tuesday", DateTime.Now.ToShortDateString());
this.BackColor = Color.Pink;
break;
case 3:
MessageBox.Show("Today is Wednesday", DateTime.Now.ToShortDateString());
this.BackColor = Color.Green;
break;
case 4:
MessageBox.Show("Today is Thursday", DateTime.Now.ToShortDateString());
this.BackColor = Color.Orange;
break;
case 5:
MessageBox.Show("Today is Friday", DateTime.Now.ToShortDateString());
this.BackColor = Color.SkyBlue;
break;
case 6:
MessageBox.Show("Today is Satuaday", DateTime.Now.ToShortDateString());
this.BackColor = Color.Purple;
break;
}
}
}
}
Sign up here with your email

ConversionConversion EmoticonEmoticon