PDA

View Full Version : Solved: Array & cbos?



bopo
01-26-2007, 12:34 PM
Hi People

Basically I have a cbo which displays 1 to 5, I want to use the number selected and * by something else, basically how to I reference the option (number) selected in a cbo?

CBrine
01-26-2007, 12:51 PM
I'm assuming this is a userform?

combobox1.text * 5

HTH
Cal

bopo
01-26-2007, 02:24 PM
I'm assuming this is a userform?

combobox1.text * 5
HTH
Cal

Hi

Yeah its a userform, For a example a user selects the "3" option from the cbo, this number is then included in some calculation, see what I mean

lucas
01-26-2007, 02:29 PM
Just to show it in use Cal:
TextBox1.Value = ComboBox1.Value * 5

bopo
01-26-2007, 02:44 PM
Just to show it in use Cal:
TextBox1.Value = ComboBox1.Value * 5

I want to use the value within the combo box to multiply the value, example

private sub textbox1_afterupdate()
txttotal = txtcost.text * "value/option selected in the combo box"

the coding probably wont work, however I am just using it as an illustration

Zack Barresse
01-26-2007, 02:51 PM
Why wouldn't you use your ComboBox_AfterUpdate event with your TextBox_AfterUpdate? Using them both and using a private sub to run would make things much easier. So when your combobox or your textbox is changed the routine would fire, keeping it much more dynamic.

HTH

lucas
01-26-2007, 02:58 PM
Private Sub ComboBox1_Change()
TextBox1.Value = ComboBox1.Value * TextBox2.Value
End Sub