C
Curtis UN
Guest
I have a problem that for some reason I can not solve lol. I am using 2017 vs community VB setup as .net 3.5 because the application I am modifying was written in 3.5.
The description of my Application is as follows:
Label maker/printing application
Label maker is being modified to use barcodes using bytescoute sdk generator
This label maker is used on a production line where you have a scales rs232 input to the app so the label is displayed on the screen with the new weight, item number, serial number etc. It is then printed, the form is updated again with new information for the next item coming off the line.
The problem I have run upon was first when saving the barcode file after is it is throwing an exception of file in use by another process so I used using block so it would dispose of all the barcode instances. now I am getting file not found from
PanelPartno.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 0.png") when it goes through this sub a second time. I have tried disposing the back ground control but it gives me another exception of System.NullReferenceException
Any help would be appreciated
Sub Build_Barcode(ByVal Barcodename() As String)
Dim Weightin As String = ""
Getdate()
REM getserialdata()
If My.Forms.LABELSELECT.ComportSelect = "LABEL PRINT NO WEIGHT" Then
Else
Weightin = Getserialdata()
End If
If Weightin = "No Comport" Or Weightin = "Cancel" Or Weightin = "OK" Then
Exit Sub
End If
' setup form for print
Weightin = Weightin + Weightunitid()
Barcodename(5) = Weightin
Barcodename(3) = Label_Setup.serialnumber
For x = 0 To 5
Using barcode As New Barcode With {.Symbology = SymbologyType.Code39, .CaptionPosition = 1}
barcodename1 = ("barcode" + Str(x) + ".png")
barcode.Value = Label_Setup.Barcodename(x)
barcode.CaptionPosition = CaptionPosition.Above
barcode.CaptionFont = New Font("Microsoft Sans Serif", 16)
barcode.SaveImage("c:\Labels\Barcode\barcode" + Str(x) + ".png")
End Using
Next x
PanelPartno.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 0.png") ' File not found
PanelPO.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 1.png")
PanelDes.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 2.png")
PanelSN.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 3.png")
PanelVN.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 4.png")
PanelVD.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 5.png")
Label_Setup.snnumber = Label_Setup.snnumber + 1
Label_Setup.serialnumber = CStr(Label_Setup.snnumber)
End Sub
Curtis
Continue reading...
The description of my Application is as follows:
Label maker/printing application
Label maker is being modified to use barcodes using bytescoute sdk generator
This label maker is used on a production line where you have a scales rs232 input to the app so the label is displayed on the screen with the new weight, item number, serial number etc. It is then printed, the form is updated again with new information for the next item coming off the line.
The problem I have run upon was first when saving the barcode file after is it is throwing an exception of file in use by another process so I used using block so it would dispose of all the barcode instances. now I am getting file not found from
PanelPartno.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 0.png") when it goes through this sub a second time. I have tried disposing the back ground control but it gives me another exception of System.NullReferenceException
Any help would be appreciated
Sub Build_Barcode(ByVal Barcodename() As String)
Dim Weightin As String = ""
Getdate()
REM getserialdata()
If My.Forms.LABELSELECT.ComportSelect = "LABEL PRINT NO WEIGHT" Then
Else
Weightin = Getserialdata()
End If
If Weightin = "No Comport" Or Weightin = "Cancel" Or Weightin = "OK" Then
Exit Sub
End If
' setup form for print
Weightin = Weightin + Weightunitid()
Barcodename(5) = Weightin
Barcodename(3) = Label_Setup.serialnumber
For x = 0 To 5
Using barcode As New Barcode With {.Symbology = SymbologyType.Code39, .CaptionPosition = 1}
barcodename1 = ("barcode" + Str(x) + ".png")
barcode.Value = Label_Setup.Barcodename(x)
barcode.CaptionPosition = CaptionPosition.Above
barcode.CaptionFont = New Font("Microsoft Sans Serif", 16)
barcode.SaveImage("c:\Labels\Barcode\barcode" + Str(x) + ".png")
End Using
Next x
PanelPartno.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 0.png") ' File not found
PanelPO.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 1.png")
PanelDes.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 2.png")
PanelSN.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 3.png")
PanelVN.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 4.png")
PanelVD.BackgroundImage = Image.FromFile("C:\Labels\Barcode\barcode 5.png")
Label_Setup.snnumber = Label_Setup.snnumber + 1
Label_Setup.serialnumber = CStr(Label_Setup.snnumber)
End Sub
Curtis
Continue reading...