0

I want to print a label through a Dymo LabelWriter 450 using the Dymo.Connect.SDK NuGet package.

Here my code:

Imports DymoSDK.Implementations
Imports DymoSDK.Interfaces


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim dymoSDKLabel As DymoSDK.Implementations.DymoLabel
    dymoSDKLabel.LoadLabelFromFilePath("path\Name.dymo")
    Dim SelectedPrinter As String = "DYMO LabelWriter 450"
    DymoPrinter.Instance.PrintLabel(dymoSDKLabel, SelectedPrinter, 1, True)

End Sub

Error message: "The object reference was not set to an object instance."

That's why I set dymoSDKLabel = new DymoLabel() before i load the path. That would have been logical for me, but I get the error message: "Error resolving overload because no "new" is accessible"

Does anyone have any ideas how i can get to my goal? Unfortunately there is no real documentation for the NuGet package or code examples. If more information is needed, just ask. I am thankful for every help.

Best regards

Senso15
  • 1
  • 2

2 Answers2

0

I had the exact same issue as you, however after looking at the 1 VB sample available for the nuget package I adapted something I found there about using DymoLabel.Instance and have now managed to print:

Dim dymoSDKLabel As DymoLabel
dymoSDKLabel = DymoLabel.Instance

It also seems necessary to retrieve the printers prior to printing, even when specifying the printer by name:

Dim SelectedPrinter As String = "DYMO LabelWriter 450" 
Dim Printers = DymoPrinter.Instance.GetPrinters()

Have to say working with this Dymo SDK is one of the worst things I have had to deal with. The documentation is appaling.

LuHu
  • 1
  • 1
0

This work well for me !!

        DymoSDK.App.Init()
        Dim dymoSDKPrinter = DymoPrinter.Instance

        Dim fullpath As String = System.IO.Path.GetFullPath(FileNameOfLabel)
        Dim dymoSDKLabel = DymoLabel.Instance
        dymoSDKLabel.LoadLabelFromFilePath(fullpath)

        Dim LabelTextObject1 As DymoSDK.Interfaces.ILabelObject
        LabelTextObject1 = dymoSDKLabel.GetLabelObject("NameOfLabel")
        dymoSDKLabel.UpdateLabelObject(LabelTextObject1, "ValueOfLabel")
        
        If dymoSDKPrinter.PrintLabel(dymoSDKLabel, LabelWriterCmb.Text, 1, False, False, 0, False, False) Then
            MsgBox("Printed !", vbInformation)
        End If

   
Salvio
  • 1