1 Replies - 636 Views - Last Post: 22 March 2010 - 10:57 AM Rate Topic: -----

#1 VBUser72  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-March 10

Input String Error

Posted 22 March 2010 - 10:53 AM

I'm getting an error on the following line of code. Error states "Input string was not in a correct format."

voteRead(subscript).count = convert.ToInt32(tally.Substring(colonIndex+1))

I've attached the additional code below. Can anyone assist?
If My.Computer.FileSystem.FileExists(file) Then
            fileContent = My.Computer.FileSystem.ReadAllText(file)

            For subscript As Integer = 0 To 2
                newLineIndex = fileContent.IndexOf(ControlChars.NewLine, nameIndex)

                tally = fileContent.Substring(nameIndex, newLineIndex - nameIndex)

                colonIndex = tally.IndexOf(": ", 0)

                voteRead(subscript).name = tally.Substring(0, nameIndex)
                voteRead(subscript).count = convert.ToInt32(tally.Substring(colonIndex+1))
                candidateListBox.Items.Add(voteRead(subscript).name)
                nameIndex = newLineIndex + ControlChars.NewLine.Length

            Next subscript

This post has been edited by JackOfAllTrades: 22 March 2010 - 10:57 AM
Reason for edit:: Added code tags. PLEASE!!! [code]...PUT YOUR CODE IN HERE!!!...[/code]


Is This A Good Question/Topic? 0
  • +

Replies To: Input String Error

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5723
  • View blog
  • Posts: 22,635
  • Joined: 23-August 08

Re: Input String Error

Posted 22 March 2010 - 10:57 AM

Moved to VB.NET
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1