Melissa,
| Ok, I tried returning the new date as you suggested - no luck...
| I tried DOB = new date(...) no luck...
By "no luck" what do you mean, what is the specific error you are getting.
Where specifically are you seeing a problem & what specifically is the
problem. Are you certain (absolutely certain) that this routine is failing &
not another routine?
My code assumes that msBirthMonth, msBirthDay, and msBirthYear are strings
with numbers in them and are in the respective ranges. Göran's code will
ensure they are integers.
For example:
Dim msBirthMonth As String = "01"
Dim msBirthDay As String = "01"
Dim msBirthYear As String = "1950"
Dim aDate As Date = New Date(CInt(msBirthYear), CInt(msBirthMonth),
CInt(msBirthDay))
Sets the aDate variable to #1/1/1950#.
Moving from .NET 1.1 to .NET 2.0 would not (should not) affect your date
logic.
| Setting a date property should be easier than this...
It is!
Private m_dob
Public Property DOB() As Date
Get
Return m_dob
End Get
Set(ByVal value As Date)
m_dob = value
End Set
End Property
Is all the code for DOB really needs.
It really depends on how msBirthMonth, ...day, ...year are being used
elsewhere if they are actually needed or not...
| I have been
| stepping through debug, and msBirthMonth, ...day, ...year are passing
| properly.
Are you getting tripped up in PostBack? Remember a web page's object get
recreated each time they post back, if you set the DOB property when the
page is initially displayed, then attempt to use DOB in the post back (in
response to a button click for example) then msBirthMonth, ...day, ...year
(ergo DOB) will have reverted to blanks...
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
| Ok, I tried returning the new date as you suggested - no luck...
| I tried DOB = new date(...) no luck...
| I tried dim mydate as date - put values in there and then dob = mydate
| ... no luck
|
| Setting a date property should be easier than this... Had the issue
| been the fact that the string was originally in dd/mm/yyyy format,
| converting the strings to integers should have resolved any of those
| problems, but yet overriding the values and hard-coding the date value
| should have resolved something also, which it still errors. I have been
| stepping through debug, and msBirthMonth, ...day, ...year are passing
| properly.
|
| This is not the only date function that has errored on the conversion
| to .NET 2.0 - ALL dates in the application are not returning
| appropriate values. Instead all I get is #12:00:00 AM# for the dob
| values in my watch.
|
| These are simply drop down boxes on an ASPX page that stores their
| values into birthmonth, birthyear and birthday. Those are then
| converted by public properties to strings as msbirthmonth, msbirthday,
| msbirthyear - then those string values are put in the date...
|