Search code examples
vb.netprintingcom

Brother label printing COM reference error


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


Solution

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