Conversion from string "" to type 'Integer' is not valid.
Posted on 2006-04-24
In an update function for my GridView, I have the following:
Dim intBudget As Integer = CType(gvr.FindControl("txtBudget"), TextBox).Text.Trim()
I get the error: An exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll but was not handled in user code
Additional information: Conversion from string "" to type 'Integer' is not valid.
What's weird is that I've used this format before...not sure why now it's throwing an error in my new application. I see that I am trying to set an integer to a Text value so how do I CType this to an Integer equivilant?