Combo Box loading speed

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

I have a pair of databound combo boxes on my page. I am
quite unhappy with the time it takes to load them. Is
there a way to speed it up by coding it manually or
is .datasource, .valuemember .displaymember the best?

Thanks,
Aaron
 
What's the data source for your combobox?
How many records are you loading?
 
I guess I forgot to ask you on how many records in the
table you're retreiving records from, but regardless make
sure that you have indexes on the fields you using in the
where clause.

-Alex
 
Use a datareader, much much faster!

Private Function PopulateCombo1()

sbStatbar.Text = "Loading Comment Defaults"
sbStatbar.Refresh()

Dim strSQL As String = "Select Col1 FROM Table"
Dim cmdSelect As SqlCeCommand = New SqlCeCommand(strSQL,
MasterDBconnection)
cmdSelect.CommandType = CommandType.Text

Try
Dim dtr As SqlCeDataReader = cmdSelect.ExecuteReader
(CommandBehavior.Default)
While (dtr.Read()) ' Populate Comment type combo
cmbCombo1.Items.Add(dtr.GetString(0))
End While
dtr.Close()
dtr.Dispose()

Catch ex As SqlCeException
SQLCEFuncErrorName(ex)
End Try

sbStatbar.Text = "Combo Loaded."
sbStatbar.Refresh()

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Zero Upload Speed 6
Generics lists and cloned combobox controls 5
Combo boxes 1
Databound Checkedlistbox - Check certain boxes 1
combobox woes 1
combo boxes in datagrids 2
Complex databinding 6
ComboBox Question 3

Back
Top