Epson
*

Exception occurs in VB for SetSPELVar with empty TextBox

Symptoms
If a VB string variable is set to the value of an empty TextBox and then passed in the SetSPELVar method, an exception occurs and the system must be re-booted.
 
    Dim tmpStr As String
    tmpStr = Text1  ' Text1 is empty
    SPELCom1.SetSPELVar "g_Parameter$", tmpStr

Cause
The cause is not yet known.

Remedies
There are two methods for work around:

Method 1
Pass the text box directly:
   
SPELCom1.SetSPELVar "g_Parameter$", Text1

Method 2
If the string is empty, then pass an empty string, otherwise pass the string variable.
   
Dim tmpStr As String

    tmpStr = Text1

    If tmpStr = "" Then
        SPELCom1.SetSPELVar "g_Parameter$", ""
    Else
        SPELCom1.SetSPELVar "g_Parameter$", tmpStr
    End If