Author Topic: Combobox selection value  (Read 1940 times)

Holmux

  • Newbie
  • *
  • Posts: 34
    • View Profile
Combobox selection value
« on: January 01, 2021, 10:57:42 AM »
First Happy new year  to everyone  :)

I am battling with a small issue this afternoon and hope someone could give me a hint

I have a combobox where I select a supplier and display it i the combobox selection and a second column with a Supplier_ID, which I pull out as the combobox.value into a BasicLabel

If there is a barcode on the product, I will get the supplier_ID via the Barcode scanner and would like to pick the selection in my combobox using the combobox.value

Would this be possible ?

/Holmux

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Combobox selection value
« Reply #1 on: January 01, 2021, 11:25:13 AM »
Is your combobox using databinding to gets its values from a database using the DataSource, ValueMember, and DisplayMemboer properties?

Holmux

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Combobox selection value
« Reply #2 on: January 01, 2021, 02:12:45 PM »
Hi Archie

Yes, the combobox is directly connected to the database

I have a Dataset, BindingSource and TableAdapter connected to the page

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Combobox selection value
« Reply #3 on: January 01, 2021, 02:26:28 PM »
If you want to change the combobox selection by its ID, then you would do this:

        ComboBox1.SelectedValue = 2

Holmux

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Combobox selection value
« Reply #4 on: January 02, 2021, 03:53:22 PM »
Thanks Archie

Works :)