2013-02-12 3 views
0

VB에서 메소드 이미지 바코드가 있습니다. 이미지 바코드를 데이터 세트에 저장 하시겠습니까? frm_Reporting에서 , 나는 크리스탈 리포트 뷰어를 가지고 있고, btnEncode가 호출 될 때, 이미지 바코드가 생성되면, 데이터 세트에 을 삽입해야합니다.VB에서 데이터 집합에 이미지를 추가하는 방법은 무엇입니까?

Private Sub Frm_Reporting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
     CrystalReportViewer1.ReportSource = Nothing 
     Dim rptbarcode As RptPacking 
     rptbarcode = New RptPacking 
     Dim xrep As DataSet1 
     xrep = New DataSet1 
     Dim row As DataRow 
     Dim MyImg As Image = Nothing 
     Try 
      btnEncode(MyImg, BarcodeText) 
      row = xrep.Tables(0).NewRow 
      xrep.Tables("DataTable1").Rows(0).SetAdded = MyImg 
      CrystalReportViewer1.ReportSource = rptbarcode 
      rptbarcode.SetDataSource(xrep) 
      rptbarcode.PrintToPrinter(1, False, 0, 0) 
     Catch ex As Exception 
     End Try  
    End Sub 

Private Sub btnEncode(ByRef pic As Image, ByVal txtData As String) 
     Dim W As Integer = 160 
     Dim H As Integer = 110 
     Dim b As BarcodeLib.Barcode 
     Dim type As BarcodeLib.TYPE = BarcodeLib.TYPE.UNSPECIFIED 
     type = BarcodeLib.TYPE.CODE128 
     b = New BarcodeLib.Barcode() 
     Try 
      If type <> BarcodeLib.TYPE.UNSPECIFIED Then 
       b.IncludeLabel = True 

       '===== Encoding performed here ===== 
       pic = b.Encode(type, txtData, W, H) 
       'CType(Frm, frm_submitentery).pic_img.Image = pic.Image 
       '=================================== 


      End If 

     Catch ex As Exception 
      'try 
      MessageBox.Show(ex.Message) 
      'catch 
     End Try 

    End Sub 

답변

0

당신은 가상 디렉토리에 이미지를 저장하고 배열을

를 바이트로 변환을위한 파일 스트림을 사용할 수 있습니다
관련 문제