Hi, I need to fill a combobox with every type of barcode, in C#. How can I do that ?!
Thank you!
foreach (string item in Enum.GetNames(typeof(BarCodeType)))
{ comboBox1.Items.Add(item); }
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
For Each item As String In System.Enum.GetNames(GetType(BarCodeType))
ComboBox1.Items.Add(item)
Next
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
Imports Spire.Barcode
For Each item As String In System.Enum.GetNames(GetType(Spire.Barcode.BarCodeType))
ComboBox1.Items.Add(item)
Next
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
Dim BarCodeControl1 As New BarcodeSettings()
Dim barcodeType As String = ComboBox1.SelectedItem.ToString()
BarCodeControl1.Type = CType(System.Enum.Parse(GetType(BarCodeType), barcodeType), BarCodeType)