Simple Fomatting question. Date to String and back.

P

Phillip Vong

I have a simple Formview and in the InsertMode I have a calendar and a
textbox. All I want is for people to click on a date and the date is
populated to the textbox. Here is my simple code and my problem is
converting the DateTxtBox to a date format. Can someone show me how to do
this simple conversion?

Thanks!


Protected Sub Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs)

Dim CalDate As Calendar

CalDate = FormView1.FindControl("Calendar2")

Dim test As Date

test = CalDate.SelectedDate

Dim DateTxtBox As TextBox

DateTxtBox = FormView1.FindControl("DateTextBox")

DateTxtBox = test


End Sub
 
P

Phillip Vong

Never mind, I figured it out.

Protected Sub Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs)

Dim CalDate As Calendar

CalDate = FormView1.FindControl("Calendar2")

Dim test As Date

test = CalDate.SelectedDate.ToString

Dim DateTxtBox As TextBox

DateTxtBox = FormView1.FindControl("DateTextBox")

DateTxtBox.Text = test


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top