System.FormatException: Input string was not in a correct format.????

Last post 04-14-2008 3:25 AM by Vinoo. 6 replies.

Sort Posts:

  • System.FormatException: Input string was not in a correct format.????

    01-23-2006, 9:10 PM
    • Loading...
    • d1mann
    • Joined on 01-24-2006, 2:01 AM
    • Posts 14

    The installation went fine, and is running ok on my localhost, I 'm clicking my way through the app and everything is working fine, until I try and run a report and I get:

    System.FormatException: Input string was not in a correct format

    Line 260:

    Line 261:            For Each str As String In substrings
    Line 262:                Dim id As Integer = CInt(str)
    Line 263:                list.Add(Project.GetProjectById(id))
    Line 264:            Next str
    Source File: C:\Inetpub\wwwroot\TimeTracker1\App_Code\BLL\Project.vb    Line: 262

    Have the same declaration at Line 307, but I don't know enough to understand how to reformat the string as it's passed in... Any suggestions?

    Dennis

  • Re: System.FormatException: Input string was not in a correct format.????

    01-24-2006, 12:02 AM
    • Loading...
    • Jeevi
    • Joined on 11-03-2005, 7:59 AM
    • Posts 54

    hi,

     this problem occurs when u try to convert non numeric or empty string into integer.add the following condition inside ur loop.

        For Each str As String In substrings

    IF isNumeric(str) THEN
         Dim id As Integer = CInt(str)                                                                                                   ENDIF
    :             list.Add(Project.GetProjectById(id))
        Next str

      

  • Re: System.FormatException: Input string was not in a correct format.????

    01-24-2006, 9:39 PM
    • Loading...
    • d1mann
    • Joined on 01-24-2006, 2:01 AM
    • Posts 14

    Thanks Jeevi, new to this, didn't think about passing a null value in... that validation statement fixed it!

     

  • Re: System.FormatException: Input string was not in a correct format.????

    12-14-2007, 5:09 PM
    • Loading...
    • sabena248
    • Joined on 12-11-2007, 11:20 AM
    • Posts 7

    I keep getting the same error.

    Line 324:                                                             ByRef oList As List(Of IPClass))
    Line 325:            Do While returnData.Read()
    Line 326:                Dim oItem As IPClass = New IPClass( _
    Line 327:                                               CStr(returnData("Device")), _
    Line 328:                                               CStr(returnData("Location")), _

  • Re: System.FormatException: Input string was not in a correct format.????

    12-14-2007, 10:38 PM

    Try to debug application & check the value

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: System.FormatException: Input string was not in a correct format.????

    02-04-2008, 10:26 PM

    Have you solved your problem what you are facing

    Chetan Sarode
    Software Engineer,
    Approva Systems Pvt Ltd,
    Pune, India.
  • Re: System.FormatException: Input string was not in a correct format.????

    04-14-2008, 3:25 AM
    • Loading...
    • Vinoo
    • Joined on 04-14-2008, 3:23 AM
    • Posts 1

    Hi, I have a similar problem...I am getting System.FormatException: Input string was not in a correct format while converting string to int but the string is neither empty nor non numeric.... can someone plz help me...what can be the other reason for this exception...

Page 1 of 1 (7 items)