use*_*685 1 vb.net printing com
我在 Brother bpac SDK 上玩得很开心。我有一个应用程序,我正在尝试从中打印一个标签。它以前有效,但我不知道现在出了什么问题。
这是我得到的错误:检索具有 CLSID {B940C105-7F01-46FE-BF41-E040B9BDA83D} 的组件的 COM 类工厂由于以下错误而失败:80040154 类未注册(来自 HRESULT 的异常:0x80040154)。
代码:
'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
Run Code Online (Sandbox Code Playgroud)
注意:该类在注册表中,我的项目设置为构建为 32 位应用程序。我看过的每个地方都说去项目> 属性> 构建选项卡> 目标 CPU = x86。我已经这样做了,但问题仍然存在。任何帮助将不胜感激,因为我已经尝试了我能想到的一切。
提前致谢,伊莱
为了将来参考,不要忘记为您的用户提供 b-pac 客户端设置(可以在“\Brother bPAC3 SDK\Redist\”文件夹中找到)。它必须安装在客户端机器上才能使用 dll。否则会抛出这个错误。