I have made a currency converter which converts a made up currency to UK Sterling. I have made a converter on my 1st form and on my 2nd form I need to add import duties. There are 2 import duties...

1) Air Cargo: 16.5% of Sterling price
2) Shipping: 11.5% of Sterling price

I need to multiply the the label which shows the amount of UK Sterling on form 2 by either Air Cargo or Shipping depending on which one the user chooses but I have no idea how to code up a combo box as I have never used one before on Visual Basic. Please help!

First you have to drag and drop the combo box into the form. Then, under the Form Load event in the Code Builder, you call the two options, I'm assuming from a database, using the RowSource method and SQL:

Me.ComboBox.RowSource = "SELECT * FROM [Duties] IN '" & DatabasePath & "' "
Me.Requery

If you are not using a database, just write them in yourself:

Me.ComboBox.RowSource = "Duty1" & ";" & "Duty2"
or Me.ComboBox.RowSource = 1 & ";" & 2

To get the selected value, just use the .Value method:

variable = Me![Combobox].Value 
or variable = Me.Combobox

You can replace Me![Combobox] to [OtherFormName]![Combobox].Value if you are getting it from another form.

Hope that helps :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.