Announcement

Collapse
No announcement yet.

B-PAC Brother Anwendung

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    geht's so:

    [highlight=vb]
    objDoc.GetObject("objName").Text = txtName.VALUE
    [/highlight]


    ?
    Ich habs gleich!
    ... sagte der Programmierer.

    Comment


    • #17
      Gut, läuft soweit! Barcode wird auch ausgegeben.

      Nun noch ein letztes anliegen

      Ich würde gerne noch ein Menüpunkt über das Eingabefeld haben, wo ich insg. 5 Templates auswählen kann. Könntet ihr mir den unten stehen Code dafür bisschen bearbeiten? Wäre euch sehr verdankt

      MfG

      [highlight=vbnet]'************************************************* ******************
      '
      ' b-PAC 3.0 Component Sample (Badge)
      '
      ' (C)Copyright Brother Industries, Ltd. 2009
      '
      '************************************************* ******************
      Option Explicit On

      Public Class Badge
      Const sPath = "E:\1_Datenpfad Lan-electronic GmbH\5 Formulare\Labeldruck Brother\Label Config Item.lbx"

      '************************************************* *******
      ' Open and Print a spcified file.
      '************************************************* *******
      Public Sub DoPrint()
      Dim objDoc As bpac.Document
      objDoc = CreateObject("bpac.Document")
      If (objDoc.Open(sPath) <> False) Then
      objDoc.GetObject("objName").Text = txtName.Text


      'objDoc.SetMediaByName(objDoc.Printer.GetMediaName , True)
      objDoc.StartPrint("BadgeSample", bpac.PrintOptionConstants.bpoAutoCut)
      objDoc.PrintOut(1, bpac.PrintOptionConstants.bpoAutoCut)
      objDoc.EndPrint()
      objDoc.Close()
      End If
      End Sub

      Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
      DoPrint()
      End Sub

      Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
      Me.Close()
      End Sub

      Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

      End Sub
      End Class
      [/highlight]
      Zuletzt editiert von Giersch; 08.09.2010, 14:49.

      Comment


      • #18
        Woran lag es jetzt?

        Ich würde gerne noch ein Menüpunkt über das Eingabefeld haben, wo ich insg. 5 Templates auswählen kann. Könntet ihr mir den unten stehen Code dafür bisschen bearbeiten? Wäre euch sehr verdankt
        Das solltest du in der Form nochmal im Jobs Forum posten. Vielleicht findet sich jemand der dir das Programmieren für einen kleinen Obolus abnimmt.

        Comment


        • #19
          Gute Frage, habs im Endeffekt nochmal neu compelliert und dann ging es.

          Naja es geht ja nur um so ein kleines Auswahl Menü, das sollte für euch doch kein Problem sein

          Comment


          • #20
            [highlight=vbnet] '************************************************* ******************
            '
            ' b-PAC 3.0 Component Sample (NamePlt)
            '
            ' (C)Copyright Brother Industries, Ltd. 2009
            '
            '************************************************* ******************

            Public Class Form1
            Inherits System.Windows.Forms.Form

            #Region " Windows Form Designer generated code "

            Public Sub New()
            MyBase.New()

            'This call is required by the Windows Form Designer.
            InitializeComponent()

            'Add any initialization after the InitializeComponent() call

            End Sub

            'Form overrides dispose to clean up the component list.
            Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
            If Not (components Is Nothing) Then
            components.Dispose()
            End If
            End If
            MyBase.Dispose(disposing)
            End Sub

            'Required by the Windows Form Designer
            Private components As System.ComponentModel.IContainer

            'NOTE: The following procedure is required by the Windows Form Designer
            'It can be modified using the Windows Form Designer.
            'Do not modify it using the code editor.
            Private WithEvents btnPrint As System.Windows.Forms.Button
            Private WithEvents btnExit As System.Windows.Forms.Button
            Friend WithEvents Label1 As System.Windows.Forms.Label
            Friend WithEvents cmbTemplate As System.Windows.Forms.ComboBox
            Friend WithEvents Label3 As System.Windows.Forms.Label
            Friend WithEvents txtName As System.Windows.Forms.TextBox
            <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Me.btnPrint = New System.Windows.Forms.Button()
            Me.btnExit = New System.Windows.Forms.Button()
            Me.Label1 = New System.Windows.Forms.Label()
            Me.cmbTemplate = New System.Windows.Forms.ComboBox()
            Me.txtName = New System.Windows.Forms.TextBox()
            Me.Label3 = New System.Windows.Forms.Label()
            Me.SuspendLayout()
            '
            'btnPrint
            '
            Me.btnPrint.Location = New System.Drawing.Point(40, 105)
            Me.btnPrint.Name = "btnPrint"
            Me.btnPrint.Size = New System.Drawing.Size(104, 26)
            Me.btnPrint.TabIndex = 1
            Me.btnPrint.Text = "Print label"
            '
            'btnExit
            '
            Me.btnExit.Location = New System.Drawing.Point(180, 105)
            Me.btnExit.Name = "btnExit"
            Me.btnExit.Size = New System.Drawing.Size(104, 26)
            Me.btnExit.TabIndex = 2
            Me.btnExit.Text = "Exit"
            '
            'Label1
            '
            Me.Label1.Location = New System.Drawing.Point(16, 17)
            Me.Label1.Name = "Label1"
            Me.Label1.Size = New System.Drawing.Size(64, 18)
            Me.Label1.TabIndex = 3
            Me.Label1.Text = "Template"
            '
            'cmbTemplate
            '
            Me.cmbTemplate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
            Me.cmbTemplate.Items.AddRange(New Object() {"Label Config Item", "Label2", "Label3", "Label4", "Label5"})
            Me.cmbTemplate.Location = New System.Drawing.Point(97, 13)
            Me.cmbTemplate.Name = "cmbTemplate"
            Me.cmbTemplate.Size = New System.Drawing.Size(199, 21)
            Me.cmbTemplate.TabIndex = 5
            '
            'txtName
            '
            Me.txtName.Location = New System.Drawing.Point(97, 61)
            Me.txtName.Name = "txtName"
            Me.txtName.Size = New System.Drawing.Size(199, 20)
            Me.txtName.TabIndex = 8
            '
            'Label3
            '
            Me.Label3.Location = New System.Drawing.Point(16, 61)
            Me.Label3.Name = "Label3"
            Me.Label3.Size = New System.Drawing.Size(64, 17)
            Me.Label3.TabIndex = 7
            Me.Label3.Text = "Name"
            '
            'Form1
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(320, 145)
            Me.Controls.Add(Me.txtName)
            Me.Controls.Add(Me.Label3)
            Me.Controls.Add(Me.cmbTemplate)
            Me.Controls.Add(Me.Label1)
            Me.Controls.Add(Me.btnExit)
            Me.Controls.Add(Me.btnPrint)
            Me.Name = "Form1"
            Me.Text = "Form1"
            Me.ResumeLayout(False)
            Me.PerformLayout()

            End Sub

            #End Region

            Private Const TEMPLATE_DIRECTORY As String = "E:\1_Datenpfad Lan-electronic GmbH\5 Formulare\Labeldruck Brother\"
            Private Const TEMPLATE_SIMPLE As String = "Label Config Item.lbx"
            Private Const TEMPLATE_FRAME As String = "Label Config Item 2.lbx"
            Private Const TEMPLATE_3 As String = "Label3.lbx"
            Private Const TEMPLATE_4 As String = "Label4.lbx"
            Private Const TEMPLATE_5 As String = "Label5.lbx"




            Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
            Dim templatePath As String = TEMPLATE_DIRECTORY
            If cmbTemplate.SelectedIndex = 0 Then
            templatePath += TEMPLATE_SIMPLE
            Else
            templatePath += TEMPLATE_FRAME
            End If
            Dim doc As bpac.DocumentClass = New bpac.DocumentClass
            If doc.Open(templatePath) <> False Then
            doc.GetObject("objName").Text = txtName.Text

            ' doc.SetMediaById(doc.Printer.GetMediaId(), True)
            doc.StartPrint("TestPrint", bpac.PrintOptionConstants.bpoAutoCut)
            doc.PrintOut(1, bpac.PrintOptionConstants.bpoAutoCut)
            doc.EndPrint()
            doc.Close()
            Else
            MsgBox("Open() Error: " + doc.ErrorCode)
            End If
            End Sub

            Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
            Me.Close()
            End Sub

            Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            cmbTemplate.SelectedIndex = 0
            End Sub

            Private Sub cmbTemplate_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbTemplate.SelectedIndexChanged

            End Sub

            Private Sub txtName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtName.TextChanged

            End Sub
            End Class
            [/highlight]



            So sieht es im Moment aus. Ich habe eine andere Vorlage genommen, wo schon 2 Templates zur Auswahl vorhanden waren. In der Drop Down Liste habe ich dann einfach 3 hinzugefügt wie man oben sehen kann. Meine Frage wäre hierbei jetzt wie ich die Begriffe in der Auswahl, die verschiedenen Templates von der Drucksoftware zuweisen kann. Könnt ihr mir bitte weiter helfen? MfG
            Zuletzt editiert von Giersch; 08.09.2010, 14:48.

            Comment


            • #21
              Wäre Nett wenn ich mir bei der Sache noch helfen könntet, muss das heute Fertig bekommen.

              MfG, Giersch

              Comment


              • #22
                Probleme beim einbinden der Reference zur dll

                Hallo,

                ich bastel gerade an einer Anwendung, bei der ich das B-Pac verwenden möchte. Leider ist es mir nicht möglich Refelence (bpac.dll) in mein Visual Studio 2010 einzubinden. Er nörgelt immer, dass es keine .NET Anwendung sei.

                Wie hast Du das gelöst?

                Grüße
                Martin

                Comment

                Working...
                X