S
S
smakovsky2017-09-17 15:46:38
WPF
smakovsky, 2017-09-17 15:46:38

The input string had an incorrect format, how best to remake it?

I just started learning C#, I can't figure out how to convert a string to a number. The project is built, when entering data and clicking on the button, the error "The input string had an incorrect format" occurs.
cfffa08740384118a5c1d922da3e3aa4.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Gaydak, 2017-09-17
@smakovsky

Yes, it's probably trite. you have a fourth in the text box .. well, by chance .. not confused? exactly the fourth? and there is not an "empty" line? or an extra character?
how about debugging step by step and see what you are trying to convert?
and they would see for themselves, and people could show what you have there.
And so the compiler does not lie, you do not have the correct number format, not a number there at all. letters, spaces, blank))

D
Dishu, 2017-09-23
@dishu

Alternatively use TryParse

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question