troubleshooting Question

How to populate a combobox at dropdown using a function

Avatar of jonastovsen
jonastovsen asked on
Visual Basic.NET
4 Comments1 Solution212 ViewsLast Modified:
I would like to put the code I'm using at a dropdown, into a function that is called when the dropdown is triggered.

Here is the current code

    Private Sub cmb1_1_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmb1_1.DropDown
        cmb1_1.Items.Clear()

        Rs = New ADODB.Recordset
        Rs.ActiveConnection = Conn
        Rs.Open("Select Avdeling from brk_Sted ")

        While Not Rs.EOF
            cmb1_1.Items.Add(Rs(0).Value)
            Rs.MoveNext()
        End While

        Rs.Close()
        Rs = Nothing

    End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros