Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Efficient combobox population

$
0
0

I have a form with many comboboxes with each of them having a query to populate an arraylist then the arraylist populates the combobox, all this happens on the form open event, the problem is the more comboboxes I add to the form the slower it takes to open.

Is there another way this can be done?

Here is an example of one of the comboboxes

'BRD_SCOPE
        strSql1 = "SELECT DISTINCT b.col1"
        strSql1 = strSql1 & " FROM valid_set_defs a, valid_set_values b"
        strSql1 = strSql1 & " WHERE a.vs_uid = b.vs_uid"
        strSql1 = strSql1 & " AND a.vs_name = 'EPS_BOARD'"
        strSql1 = strSql1 & " ORDER BY 1"

        myCommand = New OdbcCommand(strSql1, myConnection)
        dr = myCommand.ExecuteReader()

        While dr.Read
            EPS_BOARD_c1.Add(dr("col1"))
        End While

        dr.Close()

        Me.BRD_SCOPE.DataSource = EPS_BOARD_c1

Many thanks!


Viewing all articles
Browse latest Browse all 12583

Trending Articles