String was not recognized as a valid DateTime


A

Andres Bohren

Hi i have a GridView and have Problems to put the values into the
right Datatypes.

Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles
GridView1.RowUpdating
Dim intID As Integer =
GridView1.DataKeys(e.RowIndex).Value.ToString()
Dim strDatum As String =
GridView1.Rows(e.RowIndex).Cells(2).Text
Dim pMessage As String =
GridView1.Rows(e.RowIndex).Cells(3).Text
Dim strZitat As String =
GridView1.Rows(e.RowIndex).Cells(4).Text

'When i try to convert the Strings into the correct Datatypes i get
the error "String was not recognized as a valid DateTime"
Dim pDatum As Date = Date.parse(strStatum)
Dim pZitat As Boolean = Boolean.Parse(strZitat)

'Same Result here "String was not recognized as a valid DateTime"
Dim pDatum As Date = Date.Parse(strDatum)
Dim pZitat As Boolean = Boolean.Parse(strZitat)

***********************************************************************
lbldebug.Text = "ID: " & intID & "<br>" & "Datum: " & strDatum &
"<br>" & "Message: " & pMessage & "<br>" & "Zitat: " & strZitat

ID: 1183
Datum: 02.01.2008
Message: This is my message
Zitat: True
***********************************************************************

What's wrong here?
 
Ad

Advertisements


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

Top