0

I have one datatable in which on column name is LotNo which is text and i want to copy to another datatable in which lotno from one table will be convert to Barcode. I am using barcode lib download from NuGet manage.

enter image description here

Private Sub CopyDatable()
        Dim barcode As Zen.Barcode.Code128BarcodeDraw = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum

        Dim OldDt As DataTable = New DataTable()
        Dim NewDt As DataTable = New DataTable()

        For Each sourcerow As DataRow In OldDt.Rows
            Dim destRow As DataRow = NewDt.NewRow()
            destRow("Item Name") = sourcerow("Item Name")
            destRow("Iwt") = sourcerow("Iwt")
            destRow("LotNo") = barcode.Draw(sourcerow("LotNo"), 50)
            NewDt.Rows.Add(destRow)
        Next
    End Sub
jmcilhinney
  • 50,448
  • 5
  • 26
  • 46
Nandan
  • 39
  • 5
  • 1
    And what is your question? – Jonathan Willcock May 12 '23 at 14:33
  • The following may be helpful: https://stackoverflow.com/a/75951980/10024425 and https://stackoverflow.com/a/70321177/10024425 (see code under "default.aspx.vb") – Tu deschizi eu inchid May 12 '23 at 14:34
  • convert datatable text column to barcode and print it on RDLC report using vb.net – Nandan May 13 '23 at 15:42
  • A [DataTable](https://learn.microsoft.com/en-us/dotnet/api/system.data.datatable?view=net-7.0) doesn't have a _Text_ column. It has a collection of [DataColumn](https://learn.microsoft.com/en-us/dotnet/api/system.data.datacolumn?view=net-7.0)s which has a [DataType](https://learn.microsoft.com/en-us/dotnet/api/system.data.datacolumn.datatype?view=net-7.0) property. It's unclear whether or not your project contains a [DataGridView](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridview?view=windowsdesktop-7.0) or if you placed that in your post for illustration purposes. – Tu deschizi eu inchid May 13 '23 at 16:02
  • As shown in the OP, it seems that a barcode wouldn't be very useful since it would be rather difficult to isolate the appropriate barcode when using a barcode scanner which would result in one scanning the wrong barcode. – Tu deschizi eu inchid May 13 '23 at 16:03
  • Not sure what your question really is. There isn't a conversion from text to barcode. A barcode is simply a visual representation of 'normally' string data. Reasonably common practice is to use a specific font, of which many are available for download, some free, others not. Also note, there are many different types of barcode encodings, some (such as EAN13) while not be able to correctly represent your data, while others will – Hursey May 14 '23 at 20:43

0 Answers0