Brother label printing COM reference error

1

I am having a horrible time with the Brother bpac SDK. I have an application and I am trying to print a label from it. It worked before but I do not know what is wrong now.

Here is the error I am getting: Retrieving the COM class factory for component with CLSID {B940C105-7F01-46FE-BF41-E040B9BDA83D} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Code:

   'Set up the path and template variables
    Dim path As String = "LabelTemplates\SolutionIDtemplate.lbx"

    'Create the bpac document
    Dim doc As New bpac.Document

    If doc.Open(path) <> False Then

        doc.GetObject("objID").Text = id
        doc.GetObject("objExpDate").Text = expDate
        doc.GetObject("objName").Text = name

        'Print the label
        doc.StartPrint("", bpac.PrintOptionConstants.bpoDefault)
        doc.PrintOut(copies, bpac.PrintOptionConstants.bpoDefault)
        doc.EndPrint()
        doc.Close()

    Else

        MessageBox.Show("Error: " + CStr(doc.ErrorCode))

    End If

NOTE: The class is in the registry and my project is set up to build as a 32 bit application. Everywhere I have looked says to go to Project > Properties > Build Tab > Target CPU = x86. I have done this but the problem still persists. Any help would be much appreciated because I have tried everything that I can think of.

Thanks in advance, Eli

vb.net
printing
com
asked on Stack Overflow Oct 24, 2014 by user3711685

7 Answers

6

For future reference, do not forget to give your users b-pac client setup (can be found in the "\Brother bPAC3 SDK\Redist\" folder). It must be installed in the client machine to use the dll. Or this error will be thrown.

answered on Stack Overflow May 25, 2016 by Emre Can Serteli
1

I received the same error on a application i wrote for work when i started using .net 4. That looks like sample code they provide in there SDK. When i changed it to not check for the open path, i was able to get it to work.

Additionally, make sure you have the latest drivers installed with the Bpac printer. This is my altered code.

  Dim path As String = My.Application.Info.DirectoryPath
  Dim doc As New bpac.Document
    doc = CreateObject("bpac.Document")
    doc.SetPrinter(doc.GetPrinterName().ToString, True)

    doc.Open(path + "/TesterLabel.lbx")
    doc.GetObject("objTicket").Text = lstTickets.Items.Item(0).ToString
    doc.GetObject("objTest").Text = issue
    doc.GetObject("objClaim").Text = strIssue
    doc.DoPrint(PrintOptionConstants.bpoDefault, "")
    doc.EndPrint()
    doc.Close()
answered on Stack Overflow Oct 24, 2014 by Cody Popham
0

So I reinstalled the SDK and that seemed to work. Thanks for the suggestions.

answered on Stack Overflow Oct 27, 2014 by user3711685
0

The solution for me was to install the Printer in Windows.

answered on Stack Overflow Dec 6, 2016 by Sebastian Ax
0

For me the trick was to install the right version of the SDK SDK Version after that I installed the client drivers and it worked

answered on Stack Overflow Apr 9, 2018 by Flipponachi
0

For me it was setting the target framework to .Net 4.0. I am using Brothers SDK: 3.3.001 (64-bit ver.) released 07/07/2020

answered on Stack Overflow Sep 22, 2020 by Eric Snyder
0

i've solved with Project > Properties > Build Tab > Target CPU anycpu - target destination cpu any cpu. remember see properties setup project.

answered on Stack Overflow Sep 27, 2020 by Oncelot

User contributions licensed under CC BY-SA 3.0