First off I'd like to mention I'm a student taking C# this semester. The instructor I have has not been helpfull in teaching the language I feel, and I leave the class more confused than when I entered. She gave us an assignment that requires us to make a calendar that performs calculations with dates counting days to and past Valentines day which is then displayed in a richTextBox as the appropriate sentence depending on what date is selected within the monthCalendar. I am having problems with figuring out how to do the calculations and then displaying the number from the calculations within the sentence. I welcome any help and thank you in advance. The code i have from the .cs file is as follows:
using
System;
using System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
{
if (e.Start.CompareTo(new DateTime(2009, 2, 14)) == 0)
{
richTextBox1.Text =
"Happy Valentines day";
}
else if (e.Start.CompareTo(new DateTime(2009, 2, 14)) <= 0)
{
richTextBox1.Text =
"Its #ofdays until Valentines Day";
}
else
{
richTextBox1.Text =
"Its been #ofDays since Valentines Day";
}
}
}
}