Simple Fomatting question. Date to String and back.

  • Thread starter Thread starter Phillip Vong
  • Start date Start date
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
 
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
 
Back
Top