Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends....
I need to make a counter as following problem .....

if the deviation textbox get minus value then delayed pm will be count increment deviation text box gets positive value then the pending pm will be increment ...

this is how I find the deviation

C#
private void dtpPM_ValueChanged(object sender, EventArgs e)
{
	DateTime startdate = Convert.ToDateTime(dtpPM.Text.ToString());
	DateTime enddate = Convert.ToDateTime(dtpPMCom.Text.ToString());

	System.TimeSpan diffResult = startdate - enddate;

	txtdeviation.Text = diffResult.ToString();
}


it's working fine.... I need to find the count for
eg :- deviation = -3
delayed pm = 1
pending pm = 0


deviation = 4
delayed pm = 0
pending pm = 1

still I didn't find any solution.... pls anyone help me... :(
thanks
Posted
Updated 15-May-14 23:42pm
v3
Comments
CodingLover 16-May-14 0:13am    
Can you explain what you really mean by deviation?
Asa code 16-May-14 1:17am    
deviation means difference of no of days.... planned pm date - completed pm date

try below if you need to increment base on time span
C#
if(diffResult <0)
{
   delayed++;
}else
{
   pending++;
}
 
Share this answer
 
v2
Try txtdeviation.Text = txtdeviation.Text - diffResult.ToString();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900