This is a migrated thread and some comments may be shown as answers.

populate a ComboBox

1 Answer 92 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
R
Top achievements
Rank 1
R asked on 09 Jul 2008, 11:22 AM
I am trying to populate a ComboBox with data from a access db. I have the following code that works in a normal combobox, but with the radcombobox does nothing:

                Dim ComboBox1 As New Telerik.WinControls.UI.RadComboBox 
 
                Dim cn As OleDbConnection 
                Dim connString As String = ligacao 
                cn = New OleDbConnection(connString) 
 
                cn.Open() 
                Dim da As New OleDb.OleDbDataAdapter(sql, cn) 
 
                Dim ds As DataSet = New DataSet 
                da.Fill(ds, "Tabela"
 
                With ComboBox1 
                    .DataSource = ds.Tables(0) 
                    .DisplayMember = "D1" 
                    .ValueMember = "D2" 
                End With 

Can you tell me what I have to change to make it work?

Thanks

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 11 Jul 2008, 02:46 PM
Hello R,

Thank you for the question.

Please keep the following in mind when creating and binding RadComboBox in run-time:
  1. Add your instance of RadComboBox to its parent form before data-binding occurs.
  2. Set its ValueMember and DisplayMember properties before setting its DataSource. This will significantly increase the performance.
I hope this is helpful. If you have other questions do not hesitate to contact me again.

 
All the best,
Martin Vasilev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
R
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or