I'm just curious, really.
There was some code that wasn't handling empty strings before converting, essentially calling
Dim StringToConvert As String = ""
Dim a As Integer = CInt(StringToConvert)
Rather then something like
Dim StringToConvert As String = ""
Dim a As Integer = CInt("0" & StringToConvert)
and so it makes sense that it would throw an error...
What I don't understand is that this wasn't throwing an error on my machine when I was debugging. But it does throw an error when compiled!
Here is what calls the CInt function and only sometimes throws an error:
Public NotInheritable Class SomeForm
    Inherits Windows.Forms.Form
    Private Sub TextBox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles TextBox.LostFocus
        StaticHolderClass.StaticMethod(DirectCast(sender,TextBoxBase))
    End Sub
End Class
Public NotInheritable Class StaticHolderClass
    Public Shared Sub StaticMethod(ByVal sender As Windows.Forms.TextBoxBase)
        sender.Text = Format(CInt(sender.Text),"#,#")
    End Sub
End Class
Does anyone know why this would happen?
 
    