Click here to Skip to main content
15,885,680 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why the error is giving COnvertion of string to integer is not right formate in give ling below ?

Dim result As Integer = Integer.Parse(inpHide.Value.ToString())

here inpHide is a Input hidden control
Posted
Updated 20-Apr-12 23:44pm
v2
Comments
Richard MacCutchan 21-Apr-12 5:37am    
What is the value of inpHide.Value.ToString()?
Janardan Pandey 21-Apr-12 5:59am    
the value is string received from input hidden control and want to convert in integer
Richard MacCutchan 21-Apr-12 13:41pm    
No, string is its type, what is the value returned in the string? Judging by the problem you report it is not a valid number.

Use methods like[^] Integer.TryParse. These ensure that a value is converted to an integer only if it is an integer type.
 
Share this answer
 
Comments
VJ Reddy 23-Apr-12 19:48pm    
Good answer. 5!
Abhinav S 23-Apr-12 23:15pm    
Thank you.
Hi,
The best solution to find out and get rid of that error is to watch inpHide.Value, try to debug your application.

Cheers
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900