Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calendar sends null date string

Status
Not open for further replies.

lifeforest

Programmer
Nov 9, 2006
16
CA
I am using the calendar to sends dates to my crystal reports. The weird thing is, most of the time the calendar works fine, but sometimes it sends null strings which lead my crystal report crashes. Any hints?
 


crParameterFieldLocation = crParameterFieldDefinitions.Item("pfRepStartDate")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = Me.Calendar1.SelectedDate
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)


crParameterFieldLocation = crParameterFieldDefinitions.Item("pfRepEndDate")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = Me.Calendar2.SelectedDate
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
 
1) You've now learned the importance of checking data before trying to use it.

2) Calendar seems to be a web control. If this is for ASP.NET you should really ask in the ASP.NET forum. There are of course some people that visit here that do some ASP.NET, but you have to hope they come by and see this.

3) The only thing I can suggest is doing a pop-up message letting you know when it is returning a null value so you might see what situations are causing it. Or if in a user enviroment have prompt them to reselect the date. If the object allows an escape or delete key that could be a problem. On the off chance you might make sure the Calendar object has focus before getting the date. I don't know that it will actually do anything, but couldn't hurt. Or...

From a VB.NET Windows Form perspective:

4) Use a DateTimePicker or a MonthCalendar if possible to return your date instead. I've never had that kind of problem with either of those.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Here: forum855

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top