Spire.Barcode is a professional barcode library specially designed for .NET developers (C#, VB.NET, ASP.NET, .NET Core) and Java developers (J2SE and J2EE) to generate, read and scan 1D & 2D barcodes.

Thu Sep 10, 2015 5:59 am

Hi, I need to fill a combobox with every type of barcode, in C#. How can I do that ?!
Thank you!

ionutm
 
Posts: 2
Joined: Wed Jul 22, 2015 5:57 am

Thu Sep 10, 2015 6:36 am

Hello,

Thanks for your inquiry.
Here is the sample code for your reference.
Code: Select all
foreach (string item in Enum.GetNames(typeof(BarCodeType)))
           { comboBox1.Items.Add(item); }


Best Regards,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Sep 10, 2015 7:00 am

Thank you.

ionutm
 
Posts: 2
Joined: Wed Jul 22, 2015 5:57 am

Thu Sep 10, 2015 8:00 am

Hello,

Please feel free to contact us, if you have any questions or needs. We are here for help.

Best Regards,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Oct 08, 2020 6:23 am

sweety1 wrote:Hello,

Thanks for your inquiry.
Here is the sample code for your reference.
Code: Select all
foreach (string item in Enum.GetNames(typeof(BarCodeType)))
           { comboBox1.Items.Add(item); }


Best Regards,
Sweety
E-iceblue support team

can you help me i need this code on VB.net

Unixron
 
Posts: 7
Joined: Fri Feb 22, 2019 8:40 am

Thu Oct 08, 2020 6:40 am

Hi Unixron,

Thanks for your inquiry.
Below is the corresponding code in VB.NET. If you need further assistance, please feel free to let us know.
Code: Select all
        For Each item As String In System.Enum.GetNames(GetType(BarCodeType))
            ComboBox1.Items.Add(item)
        Next


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Thu Oct 08, 2020 6:50 am

rachel.lei wrote:Hi Unixron,

Thanks for your inquiry.
Below is the corresponding code in VB.NET. If you need further assistance, please feel free to let us know.
Code: Select all
        For Each item As String In System.Enum.GetNames(GetType(BarCodeType))
            ComboBox1.Items.Add(item)
        Next


Sincerely,
Rachel
E-iceblue support team


My program show Type "BarCodeType" is not defined How to fix it?
sorry i'm newbie programmer. and not strong for english.

Unixron
 
Posts: 7
Joined: Fri Feb 22, 2019 8:40 am

Thu Oct 08, 2020 6:58 am

Hello,

Thanks for your reply.
Please first add the dll of Spire.Barcode to your project, and then add the following line to import the namespace Spire.Barcode.
Code: Select all
     Imports Spire.Barcode

Or you can use the following code instead. If you have other questions, just feel free to write back.
Code: Select all
        For Each item As String In System.Enum.GetNames(GetType(Spire.Barcode.BarCodeType))
            ComboBox1.Items.Add(item)
        Next


Sincerely,
Rachel
E-iceblue support team
Last edited by rachel.lei on Thu Oct 08, 2020 7:01 am, edited 1 time in total.
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Thu Oct 08, 2020 7:00 am

Thank you very much. it's work ^^ :D

Unixron
 
Posts: 7
Joined: Fri Feb 22, 2019 8:40 am

Thu Oct 08, 2020 7:05 am

Hello,

You are welcome.
Feel free to contact us if you have further questions.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Thu Oct 08, 2020 7:15 am

rachel.lei wrote:Hello,

Thanks for your reply.
Please first add the dll of Spire.Barcode to your project, and then add the following line to import the namespace Spire.Barcode.
Code: Select all
     Imports Spire.Barcode

Or you can use the following code instead. If you have other questions, just feel free to write back.
Code: Select all
        For Each item As String In System.Enum.GetNames(GetType(Spire.Barcode.BarCodeType))
            ComboBox1.Items.Add(item)
        Next


Sincerely,
Rachel
E-iceblue support team


it's can't generater.
BarCodeControl1.Type = cbTypeBar.SelectedValue ---- not Work
BarCodeControl1.Type = cbTypeBar.SelectedText ---- Error
BarCodeControl1.Type = cbTypeBar.Text ---- Error

Unixron
 
Posts: 7
Joined: Fri Feb 22, 2019 8:40 am

Thu Oct 08, 2020 8:44 am

Hello,

Please refer to the following code. Feel free to write back if you have any questions in this regard.
Code: Select all
        Dim BarCodeControl1 As New BarcodeSettings()
        Dim barcodeType As String = ComboBox1.SelectedItem.ToString()
        BarCodeControl1.Type = CType(System.Enum.Parse(GetType(BarCodeType), barcodeType), BarCodeType)


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.BarCode