• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Error message during Databind in C#/Visual Studio 2008

I am trying to databind an integer from a text box and am getting the following error:

System.FormatException was unhandled
  Message="Input string was not in a correct format."
  Source="mscorlib"

I am successfully populating a text box with a number - say 21139.

This is the line of code I am getting the error on:

mortgee.MortId = int.Parse(this.txtNextMortId.Text.ToString());

Where mortgee is a business object i have created, and MortId is a public member that is an integer.

Any Ideas.. I hope I described this ok.

I try to bind to this value with the below code:
0
jamesdean666
Asked:
jamesdean666
1 Solution
 
ororioleCommented:
Its telling you that your input string has non integer chars in it. Alphas, whatever, that it cant convert to an integer. So look at what you are passing to int.Parse.
0
 
jamesdean666Author Commented:
Thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now