by pachecf on Fri Oct 09, 2009 12:10 am
This is simple:
1. add a combo box to your form (combobox1)
2. double click your form and add the following to the form load event
'This will add the numbers from 1 to 100 to the combo box for selection
For x = 1 To 100
ComboBox1.Items.Add(x)
Next
3. add a text box (TextBox1) to your form
4. double click on your combobox1 control and add the following script to the ComboBox1_SelectedIndexChanged event
Dim x, y, z As Integer
x = ComboBox1.Text
x = x - 1
If x >= 2 Then
z = 1
For y = 1 To x
z = z * 2
Next
ElseIf x = 0 Then
z = 1
ElseIf x = 1 Then
z = 2
End If
TextBox1.Text = z
5 Test it !