[thelist] error using .NET calendar to set value of textbox

Matt Warden mwarden at gmail.com
Mon Oct 1 12:10:30 CDT 2007


On 10/1/07, Joel D Canfield <joel at streamliine.com> wrote:
> when I select a date in the popup calendar, I get the error "Object
> reference not set to an instance of an object" referencing this line:
>
>     Line 10:  txtHireDate.Text = calHireDate.SelectedDate.ToString("d")
>
> I don't even know which object it's referring to, 'txtHireDate' or
> 'calHireDate'

Well we can figure that out right quick. Add a line before line 10 like:

txtHireDate.Text = "foo"

Re-run. If the new line 10 errors out, it was txtHireDate (at least --
could also be a problem with calHireDate). If line 11 errors out, it
was calHireDate causing the error.

-- 
Matt Warden
Cincinnati, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list