How to programmatically populate a multicolumn combobox

3 posts, 0 answers
  1. Gaston
    Gaston avatar
    7 posts
    Member since:
    Aug 2013

    Posted 01 Jun 2014 Link to this post

    I am trying to programmatically populate a multicolumn combobox after user selected another customer from the previous combo box
    this is the sample of the code.
    01.private void RadMultiColumnComboBox3SelectedIndexChanged(object sender, EventArgs e)
    02.       {
    03.           string a;
    04.           a = string.Format("{0}", radMultiColumnComboBox3.EditorControl.Rows[radMultiColumnComboBox3.SelectedIndex].Cells["customerID"].Value);
    05.           Int32 b;
    06.           Int32.TryParse(a, out b);
    07.           radMultiColumnComboBox4.Enabled = true;
    08.           OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/RoadRunnerDB.mdb");
    09.           string cmdStr = string.Format("Select * FROM addressList WHERE customerID = {0}", b);
    11.           try
    12.           {
    13.               conn.Open();
    14.               OleDbCommand cmd = new OleDbCommand(cmdStr, conn);
    15.               OleDbDataReader reader = cmd.ExecuteReader();
    16.               //fill the grid!??
    17.           }
    18.           catch (Exception ex)
    19.           {
    20.               MessageBox.Show(ex.Message);
    21.           }
    22.       }

  2. Dimitar
    Dimitar avatar
    2983 posts

    Posted 04 Jun 2014 Link to this post

    Hello Gaston,

    Thank you for writing.

    You can load the data from the reader as follows:

    Detailed information is available in the following article: Binding to DataReader.

    Please let me know if there is something else I can help you with.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. Gaston
    Gaston avatar
    7 posts
    Member since:
    Aug 2013

    Posted 08 Jun 2014 in reply to Dimitar Link to this post

    Thank you it worked like a charm! :D
Back to Top