I have to set different values of a variable through the selection of a Combobox. But even if the clause reported in the Combobox is selected, the value is 0. Here is what I wrote:
In the form where the Combobox is located:
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.SelectedItem = "Ultra-fast"
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
End Sub
In the form where I have to set the value of the variable (calling the Combobox):
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim growth as Integer
If Form2.ComboBox1.SelectedItem = "Ultra-fast" Then
growth = 75
ElseIf Form2.ComboBox1.SelectedItem = "Fast" Then
growth = 150
ElseIf Form2.ComboBox1.SelectedItem = "Medium" Then
growth = 300
ElseIf Form2.ComboBox1.SelectedItem = "Slow" Then
growth = 600
End If
End Sub
Where am I doing wrong? I've also checked that the form where the Combobox is opened and it remains active when I call the Combobox. I've setted a label to write the value of "growth" but it always remains equal to zero. Thanks all are gonna answer me. Best regards.