Using VB.Net
If the grid cell value is empty, i am getting error as “Conversion from string “” to type ‘Double’ is not valid”
Code (gridview_CellLeave)
Dim z1, z2, z3, z4 As Int32
If grvList.CurrentRow.Cells(1).Value <> "" Then
z1 = grvList.CurrentRow.Cells(1).Value
End If
If grvList.CurrentRow.Cells(2).Value <> "" Then
z2 = grvList.CurrentRow.Cells(2).Value
End If
If grvList.CurrentRow.Cells(3).Value <> "" Then
z3 = grvList.CurrentRow.Cells(3).Value
End If
If grvList.CurrentRow.Cells(4).Value <> "" Then
z4 = grvList.CurrentRow.Cells(4).Value
End If
How to solve this error.
Need Vb.net code Help
as suggested, use the TryParse method, thus avoiding also use the try / catch, because that method already handles any format errors.
and so all other
Regards.