ASP.NET C' convertTOINT error

hi,

I have a C# error on my ASP.NET web application.

Here is the error:

Error
the code should convert the text to a int but for some reason it is failing./
SmashAndGrabAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
The input probably isn't an integer.  eg one instead of 1
Chinmay PatelChief Technical NinjaCommented:
Check value of tbestotheraales text box. The error is coming from that.
Dirk StraussSenior Full Stack DeveloperCommented:
Your error is not on tbCustomerMargin.Text but on tbEstOtherSales.Text... and the error is stating that you are trying to convert from string to date time. I would check what the value is of tbEstOtherSales.Text and then handle that. You could always use int.TryParse.

int num1;
bool isInt = int.TryParse(tbEstOtherSales.Text, out num1);
if (res == true)
{
    // String is number. Use integer variable num1.
}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ste5anSenior DeveloperCommented:
Just a comment:

hmm, where do you use this?

Cause it looks like you're trying to write data to a database. In this case you should use data transfer objects (POCO's) and the repository pattern.
Don't interact with your UI directly.
If it is your view model, then you don't use Sql{Type}.Null, cause this would couple it to the underlying storage.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.