Reputation: 13
App & Code
Private Sub PriceBox_Click(sender As Object, e As EventArgs) Handles PriceBox.Click
If CmbSize.SelectedIndex = 0 Then
PriceBox.Text = "£30"
ElseIf CmbSize.SelectedIndex = 1 Then
PriceBox.Text = "£40"
ElseIf CmbSize.SelectedIndex = 2 Then
PriceBox.Text = "£50"
End If
End Sub
This Code works but only when clicked, What sub do i need to use for it to change automatically when Combobox index is selected
Upvotes: 0
Views: 37
Reputation: 11773
If you only want user changes of the index and not programmatic changes then use
SelectionChangeCommitted
Upvotes: 1
Reputation: 4207
The combobox has SelectedIndexChanged-event you can use:
Private Sub CmbSize_Changed(sender As Object, e As EventArgs) Handles CmbSize.SelectedIndexChanged
End Sub
Upvotes: 0
Reputation: 674
You will need to handle the SelectedIndexChanged on the CmbSize control as shown in https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.combobox.selectedindexchanged?view=netframework-4.7.2
Upvotes: 0