Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15057

VS 2013 Combobox change based on a different combobox

$
0
0
Hi everyone,

So I have made a userform using VBA in excel and I have decided to make it an app for my colleagues, thing is, I've never actually worked with VB.net, but I do like to learn, long story short:

I managed to make a combobox values dependant from a different combobox in VBA but I'm unable to achieve this in VB.NET,

This is how I did it in VBA:

Code:

Private Sub ComboBox2_Change()

        Application.EnableEvents = False
        ComboBox3.Clear
        Application.EnableEvents = True
       
            Select Case ComboBox2.Value
                Case "Bodyshell"
                    ComboBox3.Enabled = False
                    ComboBox3.Value = "N/A"
                Case "Underbody"
                    ComboBox3.Enabled = False
                    ComboBox3.Value = "N/A"
                Case "Bodyside Assembly"
                    ComboBox3.Enabled = True
                    ComboBox3.AddItem "LH"
                    ComboBox3.AddItem "RH"
                Case "Bodyside Inner"
                    ComboBox3.Enabled = True
                    ComboBox3.AddItem "LH"
                    ComboBox3.AddItem "RH"
....etc.
End Select


End Sub

And it works perfectly, I tried the same in VB.net but apparently that's not the correct way as it seems:

Code:

    Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.SelectedIndexChanged

        Select Case ComboBox2.SelectedValue
            Case "Bodyshell"
                ComboBox3.Enabled = False
                ComboBox3.Items.Clear()
                ComboBox3.ValueMember = "N/A"
        End Select

    End Sub

So far that's the only part I'm stuck on, so if anyone could please help I'd be grateful,

Thank you

Viewing all articles
Browse latest Browse all 15057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>