I think the line “Input string was not in a correct format” explains it all. In the line
int i = Convert.ToInt32(str);
str might be containing alphabetic characters. Take a look at it while debugging, what does it contain?
More Related Contents:
- What are Automatic Properties in C# and what is their purpose?
- Transactions in .net
- How do I suspend painting for a control and its children?
- Is shifting bits faster than multiplying and dividing in Java? .NET? [closed]
- How do I deserialize a complex JSON object in C# .NET?
- What exactly happens when I set LoadUserProfile of IIS pool?
- How to tell Json.Net globally to apply the StringEnumConverter to all enums
- Why does Enumerable.All return true for an empty sequence? [duplicate]
- What are the benefits of using C# vs F# or F# vs C#? [closed]
- A reusable pattern to convert event into task
- Single click edit in WPF DataGrid
- What is a module in .NET?
- How do you prevent a windows from being moved?
- How to force C# .net app to run only one instance in Windows? [duplicate]
- Log off user from Win XP programmatically in C#
- C#6.0 string interpolation localization
- Determine if a type is static
- InvalidProgramException / Common Language Runtime detected an invalid program
- Automatic Cookie Handling C#/.NET HttpWebRequest+HttpWebResponse
- How do I create a file AND any folders, if the folders don’t exist?
- Where in memory are nullable types stored?
- Convert binary string into integer
- What is meant by “managed” vs “unmanaged” resources in .NET?
- EF5 Getting this error message: Model compatibility cannot be checked because the database does not contain model metadata
- Why only literal strings saved in the intern pool by default?
- What do ref, val and out mean on method parameters?
- How to install a Font programmatically (C#)
- click on a button in another application from my C# application?
- How to detect when laptop power cable has been disconnected?
- Custom Color Palette in Visual Studio Color Property Editor