Hi,<BR><BR>I'm working through "SAMS ASP.Net in 21 Days", and have a problem with the exercise on page 93, for which even the online source code doesn't work!<BR><BR>This code is below, and it produces an error connected to the DateTime variable - and I don't know why. <BR><BR>Can anyone explain why it doesn't work?<BR><BR>Thanks!<BR><BR>JON<BR><BR><BR><BR><BR><BR>ERROR MESSAGE<BR><BR>Cast from String ('06/27/78') to Date is not valid. <BR>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <BR><BR>Exception Details: System.InvalidCastException: Cast from String ('06/27/78') to Date is not valid.<BR><BR>Source Error: <BR>Line 4: public dtBirthDay as DateTime = "06/27/78"<BR><BR><BR><BR>ORIGINAL CODE<BR><BR><%@ Page Language="VB" %><BR><script runat="server"><BR> Class Chris<BR> public dtBirthDay as DateTime = "06/27/78"<BR> public strHairColor as string = "Brown"<BR> public strEyeColor as string = "Brown"<BR><BR> function GetDayOfWeek()<BR> dim strDay as string<BR> <BR> select case dtBirthDay.DayOfWeek<BR> case 1<BR> return "Sunday"<BR> case 2<BR> return "Monday"<BR> case 3<BR> return "Tuesday"<BR> case 4<BR> return "Wednesday"<BR> case 5<BR> return "Thursday"<BR> case 6<BR> return "Friday"<BR> case 7<BR> return "Saturday"<BR> end select<BR> end function<BR> <BR> End Class<BR><BR> sub Button_Click(obj as object, e as eventargs)<BR> dim objChris as new Chris<BR> Response.write(objChris.GetDayOfWeek)<BR> end sub<BR><BR></script><BR><html><BR> <body><BR> <form runat="server"><BR> <asp:button id="btSubmit" Text="Submit" runat="server" OnClick="Button_Click" /><BR> <p><BR> </form><BR> </body><BR></html><BR><BR>Try DateTime.value = http://aspmessageboard.com/archive/index.php/"blah"