Author: kevorkian | Posted on: 4/7/2009 11:49:19 AM | Views : 555

I am getting an error here that it cant not convert string "" into type integer.

 
Dim UpdateItem As FormViewRow = form_AppInfo.Row

Dim soldto_ID As Integer = (TryCast(UpdateItem.FindControl("soldto_id"), TextBox)).TextThe textbox is empty, but isn't that the point of TryCast?  If it is empty it should be returning Nothing right? 

Do I really have to do something like this?

 Dim soldto_ID As Integer = IIf(GenericFunctions.DoIExist(TryCast(UpdateItem.FindControl("soldto_id"), TextBox).Text) = True, (TryCast(UpdateItem.FindControl("soldto_id"), TextBox)).Text, DBNull.Value)  ...

Go to the complete details ...