Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,075 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,786 people online right now. Registration is fast and FREE... Join Now!




DateTime Problem ?

 
Reply to this topicStart new topic

DateTime Problem ?

ryan_reinaldi
13 May, 2008 - 12:46 AM
Post #1

New D.I.C Head
*

Joined: 20 Dec, 2007
Posts: 9


My Contributions
Hi y'all, I think I have a problem in my code.

I have text box that accept Date and I store the date that user have entered in a variable called txDateStart, in the code it look like this:

CODE

Dim txDateStartval as DateTime = CDate(txtAccDateStart.Text)


You see I wanna make that textbox becomes like this "" or just plain empty when the user doesn't fill anything. The Problem is when I debugged the code it still accept #12:00:00 AM# or #1/1/0001# or something like that even if the texbox was empty, how can I just make it to this "" or just empty so it doesn't pass anything to the variable that holds the textbox value. I already tried this one but it gave me nothing but just error and exceptions.

CODE

        If CDate(txtAccDateStart.Text) = String.Empty Then
            txDateStartval = CDate("")
        Else
            txDateStartval = txDateStart
        End If


I believe my code above is wrong, so can you dudes tell me how to make it right, please anykinds of help I would appreciate it Thanks.

FYI:I use Visual Studio.NET 2003



Best Regards.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 11:09PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month