String was not recognized as a valid DateTime

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andres Bohren

    String was not recognized as a valid DateTime

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

    Protected Sub GridView1_RowUp dating(ByVal sender As Object, ByVal e As
    System.Web.UI.W ebControls.Grid ViewUpdateEvent Args) Handles
    GridView1.RowUp dating
    Dim intID As Integer =
    GridView1.DataK eys(e.RowIndex) .Value.ToString ()
    Dim strDatum As String =
    GridView1.Rows( e.RowIndex).Cel ls(2).Text
    Dim pMessage As String =
    GridView1.Rows( e.RowIndex).Cel ls(3).Text
    Dim strZitat As String =
    GridView1.Rows( e.RowIndex).Cel ls(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(strS tatum)
    Dim pZitat As Boolean = Boolean.Parse(s trZitat)

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

    *************** *************** *************** *************** ***********
    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?
Working...