I have some vb.net code which should print out labels using Teklynx LabelView software (which I've had working before.)
Problem is, it runs fine on Dev machine, but when I run it on the end user's PC, I don't get any error messages until it completely dies with the "Send error report to Microsoft" message.
How can I troubleshoot this???
Relevant code:
Shared Function PrintLabels(ByVal itemDescription As String, ByVal starting As String, ByVal ending As String, ByVal qty As Integer) As Boolean
'Create "Document" (Label) object
'Close all open lv.exe processes
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("lv")
For Each p As Process In pProcess
p.Kill()
Next
Dim Lbl As Object
Lbl = CreateObject("Lblvw.Document")
Lbl.Open(labelFileName)
Dim barcodeVal As String
Dim labelText As String
Try
Dim infoArray As String()
infoArray = itemDescription.Split(New Char() {","c})
labelText = infoArray(1).ToString().Trim()
barcodeVal = infoArray(2).Trim() & starting & ending
'Load label in ReadOnly mode
Lbl.Open(labelFileName, True)
'Get field information
Dim Flds As Object
Flds = Lbl.LabelFields
Flds.Item("TEXT1").Value = labelText
Flds.Item("BARCODE1").Value = barcodeVal
Lbl.PrintLabel(qty)
Lbl = Nothing
barcodeVal = Nothing
labelText = Nothing
Return True
Catch ex As Exception
If printStatements Then
MsgBox("Error Message: " & ex.Message.ToString())
End If
Using writer As New StreamWriter(errorLog, True)
writer.AutoFlush = True
writer.WriteLine()
writer.WriteLine(DateTime.Now.ToString() & ": " & ex.Message)
End Using
Lbl = Nothing
barcodeVal = Nothing
labelText = Nothing
Return False
End Try
End Function