dammit

 avatar
unknown
csharp
3 years ago
1.2 kB
2
Indexable
private void dtEndDate_AfterExitEditMode(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if (string.IsNullOrEmpty(dtEndDate.Text) == false)
		{
			MessageBox.Show(dtEndDate.Text);
			MessageBox.Show("about to parse datetime to enddate");
			DateTime? endDate = DateTime.Parse(dtEndDate.Text);
			MessageBox.Show("parsed datetime to enddate");
			DateTime? startDate= DateTime.Parse(dtStartDate.Text);
			MessageBox.Show("parsed datetime to startDate");
			string eD = endDate.ToString();
			MessageBox.Show("sent string to ED");
			string sD = startDate.ToString();
			MessageBox.Show("sent string to SD");
			//if (IsDate(sD))	
			//MessageBox.Show("isdate is true");
			//DateTime startDate = DateTime.Parse(dtStartDate.Text);
			if(DateTime.Parse(dtEndDate.Text)<(DateTime.Parse(dtStartDate.Text)))
			{
				MessageBox.Show("End date is less than Start date, please fix this before continuing");
				endDate = startDate.Value.AddDays(1);
				string endDatePlusOne = endDate.ToString();
				dtEndDate.Text = endDatePlusOne;
				MessageBox.Show("passed endDateplusOne to enddate");
			}	
		}
		else 
		{
			MessageBox.Show(dtEndDate.Text);
			MessageBox.Show("please enter an end date date");
		}
	}