   [.net] If (something  less than 0)
  At the line:if (this.dateTimePicker.Value.CompareTo(System.DateTime.Now) < 0)It looks to be a comparison but it looks like it's saying compare a certain time to what it is now. Well, if that's so, won't the result be a true or false? I am guessing that true and false can be compared to the number 0 and 1, but even then, the less than zero doesn't makes sense. It would seem as the statement would never become less than 0. Unless somehow a null can be the result. Is this the case and is null less than 0?Thanks in advance.   public bool dateTimePicker_Validated()   {  if (this.dateTimePicker.Value.CompareTo(System.DateTime.Now) < 0)  { Error error = new Error(); error.ShowDialog(); this.dateTimePicker.Value = System.DateTime.Now; return false;  }  else  { return true;  }   }
The MSDN is your friend.;  At least point him to the "right" MSDN entry.Look here insteadThat should explain why.theTroll   ;Quote:Original post by TheTrollAt least point him to the "right" MSDN entry.Look here insteadThat should explain why.I fail to see what the GameDev FAQ has to do with this.   ;Quote:Original post by ScetQuote:Original post by TheTrollAt least point him to the "right" MSDN entry.Look here insteadThat should explain why.I fail to see what the GameDev FAQ has to do with this.Woops, pasted the wrong link in, fixed.theTroll   ;C#public int CompareTo (DateTime value)Ok, so the DateTime value inside the parenthesis means that it accepts a paramter right?The way they have the parenthesis makes it look more confusing than it has to be. Why do they type it that way? Shouldn't it look just like:C#public int CompareTo (DateTime value)Ok, so it does return a value:Return ValueA signed number indicating the relative values of this instance and the value parameter.Value DescriptionLess than zero This instance is less than value.Zero This instance is equal to value.Greater than zero This instance is greater than value. I guess I didn't think about how time can be less than time. Thank you   ;  So thisthis.dateTimePicker.Value = System.DateTime.Now;dateTimePicker must be a datetime object to have the CompareTo method under it's value property right? It's comparing this object's datetime vs. the system's datetime.   ;  System.DateTime.Now is just a static method that return the current DateTime structure.  tehTroll   ;  this.dateTimePicker.Value.CompareTo()How is it that CompareTo can be used here? Is it part of the dateTimePicker.Value?I ask because it's appended to .Value.CompareTo()Why is this so? How come dateTimePicker can use this if dateTimePicker isn't a datetime object?;Quote:Original post by fooliosthis.dateTimePicker.Value.CompareTo()How is it that CompareTo can be used here? Is it part of the dateTimePicker.Value?I ask because it's appended to .Value.CompareTo()Why is this so? How come dateTimePicker can use this if dateTimePicker isn't a datetime object?dateTimePicker.Value is just a DateTime struct.  So this.dateTimePicker.Value.CompareTo() is really a call to DateTime.ComapareTo().Hope that explains it.theTroll