ҡդӶ ʵŧ 纺촨շ٨絴͵ ᷹ФѺ

͵Դҷҧ Inbox Ѻ

˹ѡ
-
VB 6/VB.Net
ASP/ASP.Net
Ѻ¤
¹ҹ Flash Movie
ռͺش  
 RSS Feeds
 ǹŴ RSS Reader ...   Download  RSS Reader

Forum - www.g2gnet.com
Webmaster - www.g2gnet.com
Visitors - Session views
 5 6 1 6 1 8 0

7 ѹҤ ..2549
136 Users On-Line.
Visitors - Page views
 8 9 7 3 9 2 3
1 Ҿѹ ..2551

Google   
g2gnet.com
Ҵѡ:  

þ鴴 Active Report 2.0 ͡д A4

Category »  VB 6/VB.Net
: Webmaster 25/1/2552   : 16:55
(ҹ : 31164) 
ա͹ҧࡧ յԴ͡ ... ҡԴººẺѹ ѧȪҵҡ礧ԭҴ ҪѹФѺ ... ͧ 鹹Դҡ͹ 㹻ͧ 駵ҧȴ Ե DataDynamics ͧ ѧյҧ¤Ѻ ͧþʺ ¤ʹ㨡ѹҧҡ· 繹ͧ价ਤ ӧҹͧèѴ红ʴ ѳ ... Ѵ Now ġԴǺǡѺ鴫 ùӺҹ ԧ Ŵ㹡û͹ 件֧ѹդ١ͧҡҡçҹ (Human Error) ... ´ҧͧҹѹͧФѺ ... мҸǡѺ ҹѹҧԧѧҡ
Ǣͧ
Visual Basic 6.0 Ѻ÷§ҹ Active Report ͹ 1
Visual Basic 6.0 Ѻ÷§ҹ Active Report ͹ 2
á ToolBar ARViewer ͧ Active Report 2.0
ǹŴ йԸաõԴ Active Report Professional 2.0
ǹŴ
ǹŴ Source Code Ѻ MS Visual Basic 6.0 - Service Pack 6
 ǹŴ Visual Basic 6.0 SP5: Run-Time Redistribution Pack
 ǹŴ Microsoft Data Access Object (MDAC) Jet 4.0 Update
 ǹŴ Microsoft Visual Basic Service Pack 6
    Ҹ硹ǡѺʺ
  1. Code39 յѡзö 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+% (ͧҧ space ¹ФѺ)
  2. Code128A յѡзö Ţ ѡ ѭѡɳ (¡鹵ѡѧɵ ASCII ١ҧ᷹)
  3. Code128B յѡзö Ţ ѡ ѭѡɳ ѡѧɵ硴¤Ѻ
  • Ժѡҹ Ţ ѡõ˭ մҧ ҹͧ
    鹡кǹ÷ӧҹ

    Project --> References ...


    Project --> Components ...


    Design Time


    Run Time


    ǹͧ Detail Active Report
    ͡ Shape Ǥ ҹѧ (Send to back)

      سѵ Barcode - CaptionPosition
    1. 0 - ddbcCaptionNone ' ʺ
    2. 1 - ddbcCaptionAbove ' ʺ鴴ҹͧ觺   
    3. 2 - ddbcCaptionBelow ' ʺ鴴ҹҧͧ觺  
      سѵ Barcode - Style ͡˹Դͧ Code39, Code 128A, B C
      سѵԢͧ Shape - Shape
    1. 0 - ddSHRectangle '    
    2. 1 - ddSHEllipse ' ǧ
    3. 2 - ddSHRoundRectangle ' 駵ç  

    ҧͧͺ (Shape) ͺʺ
    Ѵҡҧͧд A4 (21 .) ô 5 (ColumnCount = 5)


    㹡óշ仾ѵҪԡ ѵùѡ֡ ŧд A4
    ͡ 2 ѡ (ColumnCount = 2) 蹻ФѺ ҳ 10 . 1 ѵ

    Ҵ鴡ѹ ...
    
    Option Explicit
    
    Dim rptPrint As Object
    
    ' ǹͧ
    ' ===================================================================
    Private Sub Form_Load()
    On Error GoTo ErrHandler
        Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
        Me.KeyPreview = True    ' ͧѺ˵ءó Form_KeyDown
        
        ' 
        txtBarCode.Text = ""
        txtQuantity.Text = ""
        
        ' ˹١þٻẺẺ Code128B ͹
        mnuCodeFormat(1).Checked = True
        ' BarcodeFormat 繵Ẻ Global  gBarCode Module
        ' ͵ͧء  Actyive Report - arBarcode ͧ繴
        BarcodeFormat = "Code 128B"
        
    ExitProc:
        Exit Sub
    
    ErrHandler:
        MsgBox Err.Number & " : " & Err.Description
        Resume ExitProc
    End Sub
    
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
       Select Case KeyCode
          Case vbKeyF7: cmdPreview_Click
          Case vbKeyF10:    cmdExit_Click
       End Select
    End Sub
    ' ===================================================================
    
    ' ǹͧû͹ʺ (Ѻ 0 - 9 еѡѧɵ˭ҹ)
    Private Sub txtBarCode_KeyPress(KeyAscii As Integer)
        If KeyAscii = 13 Then
            KeyAscii = 0
            SendKeys "{TAB}"
        Else
            ' öѡ 0 - 9, A - Z  a - z ... 仴 gBarCode.Bas Ѻ
            '  KeyAscii ͧѺҡѺ Integer ͹ФѺ ... ͧ
            KeyAscii = Asc(UCase(Chr(CheckAlphaNumericUCase(KeyAscii))))
    	' óբͧѡõ a - z ҹ
    	' ҡͧѡõ Code 128B Ѻҹ ǹ Code 39/128A 
    	' Ըաѭ ¡ŧ繵˭᷹ФѺ
    	
        ' ࡳҵ ... ҡҫ¹ФѺ
        ' ҡ˵ءó txtBarCode_KeyPress
        ' صԡ a  蹤ͨз (Ascii Code ͧ a  97)
        ' CheckAlphaNumericUCase(97))
    
        ' ¹ Ascii Code 繵ѡд¿ѧ Chr (Character)
        ' Chr(CheckAlphaNumericUCase(97)) = a
    
        ' ŧ繵õ˭ ... ¿ѧ UCase (Upper Case)
        ' UCase(Chr(CheckAlphaNumericUCase(97))) = A
    
        ' ŧѡ Ascii Code ¿ѧ Asc
        ' Asc(UCase(Chr(CheckAlphaNumericUCase(97)))) = 65
        '  KeyAscii 繵êԴŢӹǹ (Integer)
        '  KeyAscii = 65 ...   A ... ¤Ѻͧ
    End If
    End Sub
    
    ' ===================================================================
    '  gBarCode.bas ФѺ Ѵ繶֧÷ӧҹ
    Function CheckAlphaNumericUCase(Index As Integer) As Integer
        Select Case Index
            ' 0 - 9 (ASCII 48 - 57), A - B (ASCII 65 - 90), a - z (ASCII 97 - 122)
            Case 48 To 57, 65 To 90, 97 To 122
                CheckAlphaNumericUCase = Index
                '  ͧ Statement 㹡ä׹ҵҧ 觷ǵҹҧش
                
            Case 8          ' Back Space
            Case 13        ' Enter
            Case Else
                Index = 0
        End Select
        
        ' Return - ׹ҡѺ
        CheckAlphaNumericUCase = Index
    
    End Function
    ' ===================================================================
    
    ' ǹͧû͹ӹǹ (ѺŢҹ)
    Private Sub txtQuantity_KeyPress(KeyAscii As Integer)
        If KeyAscii = 13 Then
            KeyAscii = 0
            cmdPreview_Click
        Else
            ' ѹѺ੾ФҵŢ 0 - 9 ҹ
            KeyAscii = CheckDigitOnly(KeyAscii)
        End If
    End Sub
    
    ' ǹͧ觾ʺ
    Private Sub cmdPreview_Click()
    
        If Trim(txtBarCode.Text) = "" Or Trim(txtBarCode.Text) = "0" Or Len(Trim(txtBarCode.Text)) = 0 Then
            MsgBox "سһ͹ʺº¡͹.", vbOKOnly + vbInformation, "§ҹʶҹ"
            txtBarCode.SetFocus
            Exit Sub
        ElseIf Trim(txtQuantity.Text) = "" Or Trim(txtQuantity.Text) = "0" Or Len(Trim(txtQuantity.Text)) = 0 Then
            MsgBox "سһ͹ӹǹʺº¡͹.", vbOKOnly + vbInformation, "§ҹʶҹ"
            txtQuantity.SetFocus
            Exit Sub
        End If
        '
        ' Set ARViewer
        Set rptPrint = New arBarcode    '  Active Report Designer
        Set Me.ARViewBarCode.object = rptPrint  ' ١ҡѺ ARViewer
    End Sub
    
    Ҵǹͧ Active Report
    
    Option Explicit
    ' Ẻ Public in Form Ѻӹǹͧ
    Dim Count As Integer
    ' ÷Ѻ㹡á˹ӹǹ鴷ͧ
    Dim CountCode As Integer
    
    ' ˹Դ繵ѡ
    Dim BeginCode As String
    
    ' ===================================================================
    ' ǹͧ鹡õ駤ҵҧѺ§ҹͧ Active Report (ҹ)
    Private Sub ActiveReport_Initialize()
        PageSettings.Orientation = ddOPortrait ' ǵ
        PageSettings.PaperSize = 9 ' A4 Paper
        ' ========== ˹Ҥ ==============
        ' ˹ Twip ФѺ
        ' 1440 Twip = 1   2.54 . (»ҳ)
        ' ҡ͡˹ѴẺ˹ ͹ؤѺºѭѵҧͧ 55555+
        PageSettings.LeftMargin = 300   ' 
        PageSettings.RightMargin = 200  ' 
        PageSettings.BottomMargin = 500 ' ҧ
        PageSettings.TopMargin = 500    ' 
        ' Ѵҧͧ Column
        Detail.ColumnSpacing = 0
        
        ' Ѵþ觺鴵˹觡ҧ
        Barcode1.Alignment = ddTXCenter
        ' Ѵþʺҧҧͧ觺
        Barcode1.CaptionPosition = ddbcCaptionBelow
        ' Ѵþʺҹͧ觺
        ' Barcode1.CaptionPosition = ddbcCaptionAbove
        ' ʴʺ
        ' Barcode1.CaptionPosition = ddbcCaptionNone
        
        ' Ǩͺ͹͡þٻẺʺẺ
        ' Ẻ Code 128A
        If frmBarcodeSample.mnuCodeFormat(0).Checked Then
            Barcode1.Style = ddbcCode_128_A
            BarcodeFormat = "Code 128A"
        ' Ẻ Code 128B
        ElseIf frmBarcodeSample.mnuCodeFormat(1).Checked Then
            Barcode1.Style = ddbcCode_128_B
            BarcodeFormat = "Code 128B"
        ' Ẻ Code39
        ElseIf frmBarcodeSample.mnuCodeFormat(2).Checked Then
            Barcode1.Style = ddbcAnsi39
            BarcodeFormat = "Code 3 of 9"
        End If
        '
        ' Ѻ鹧ҹʺ͹ ... (ǡ¹ͧ ... ͺ͡)
        BeginCode = frmBarcodeSample.txtBarCode
        
        ' ͹Ѻ  ººشþ - ٻͧ (˹ӹǹ鴷ͧ)
        CountCode = Val(frmBarcodeSample.txtQuantity)
        
        ' ʴҹҷҹͧФѺ
        frmBarcodeSample.fraBarcode.Caption = " ¡þ " & BarcodeFormat & " ӹǹ " & _
                Val(frmBarcodeSample.txtQuantity) & " ¡."
    End Sub
    ' ===================================================================
    ' *** ǹӤѭ㹡ǹͺ÷ӧҹ Ҩ ***
    ' ѡ ҡ EOF = False ѹСѺ Fetch Data  Ѻա
    ' áշ EOF = True ѹش÷ӧҹ  ͡ҡ Active Report 㹷ѹ
    ' ===================================================================
    Private Sub ActiveReport_FetchData(EOF As Boolean)
        
        ' ҡùѺ鹷 1
        Count = Count + 1
        
        ' ǨͺҨӹǹ͡仹ҡҷ˹
        ' óչѧúӹǹ ... ҧ
        '  1 > 10 ...ʴ ͹ ... Т价 Else
        If Count > CountCode Then
            ' úǨ ... ͡ 55555+
            EOF = True
            
        ' ͹ ... ҷ Else
        Else
            ' ҡѧú ͧ˹ EOF = False  ͷѹСѺ Fetch Data ա
            ' ҡѹСⴴ仾§ҹǹͧ Detail_Format
            EOF = False
        End If
        
    End Sub
    ' ===================================================================
    ' ǹٻ㹡þ쨹Ҩ - Detail_Format
    ' ѹǹ͹ False ҡ ActiveReport_FetchData
    ' ===================================================================
    Private Sub Detail_Format()
        
        Barcode1.Caption = BeginCode
        
        ' óշͧþѵѵԢա 1 ˹ʺ鴺ǡ
        ' ͹觵ͧѧ㹡þ ҡسҵѡ仵ͷ¹ФѺ  123A ... ѹкǡѧ 55555+
        ' 駹 駹   ... й͹
        ' չ ... BeginCode Сȵ String ˧ѹǡŢ«Ч 
        ' BeginCode = BeginCode + 1
    

    ҵŢʺ鴢鹷 1
    End Sub
    Conclusion:
    Active Report 2.0 ʺ մö㹡÷ӧҹѴԧ ActiveX ǹѹͺʹͧ͡ҹҧ·ǤѺ § ... ѧҴŹ觢 (١ͧ) ¹֡ҡѹ ѡդ͹ҧࡧ յԴͧ ...

  • ͵ - g2gNet Dot Com
    Ţ¹ҳԪ硷͹ԡ 0407314800231
    CopyLeft © 2004 - 2099 g2gNet.Com All rights reserved.
    Email: [email protected] . 08-6862-6560