Automatic Date format functionality
Posted on 2008-10-25
I have a text box with a max length of 10 chars so mm/dd/yyyy, however I've been spending the past 30 minutes searching the forums and other sites and the only answer I found was for vb6 and even trying to format it for 2005 it still had a few problems I couldn't iron out.
Right now I have this basic line of code:
But this is throwing up an exception error "String was not recognized as a valid DateTime." When I try typing any digit in the text box.
What I'm really looking for is for VB to automatically add / in the right places after the person adds the date, for example 06051986 or 561985.
Any help would be great, i'm sure this is a quick fix but I've been coding all day and I can't get my head around this.