I have the following code for part of an application I'm building and I need some instruction on how to store this value and carry it to the next part of the program.

Private Sub dateEntryTextbox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dateEntryTextbox.TextChanged
        Dim dateEntryTextBox As Date
            FormatDateTime(DateString, DateFormat.GeneralDate)
            MsgBox("Valid Date")
        Catch ex As Exception
            MsgBox("Invalid Date")
        End Try
    End Sub

the dateEntryTextbox will be a date entered that I want to store as a date and use it to fire a sql query in another button on my app. Any assistance would be appreciated.



u r working on web application or windows application

Actually I'm working on a windows application and have decided to go with a datetimepicker instead of a text box but I guess the same question still applies. Also because the datetimepicker variable has to be stored as a date, there will have to be some conversion as well (because I'm applying the date to a sql query that has already been written.) The datetime conversion (as it's currently written) is as follows:

HAVING (((Format$((([Timestamp]-(([LoggedIn]/1000)/60))/1440)+1,"yy/mm/dd"))
Between [Start (YY/MM/DD)] And [End (YY/MM/DD)]));