If anyone can spare the time to help my cbo prob

Hi all,

I really apologise for my noobishness here...

This is a really cool forum btw can see me here for a bit but getting at my point. company uses an Access db app with a sql backend... now im kind of playing with .net particulary vb.net and windows forms...

Now I have gotten my head round these data adapters and data sets, but what I want to do is fill a combo box.

Say I have a table with 3 names in it, I can bind the data to the cbo but only the first record appears. Can somebody tell me how I would fill the cbo with all the names in the table... Is it something to do with an array

To be honest I dont even need the full answer, I just need some kind hearted guidance as to where I could learn how to do this.

Thanks a million.

Barry



Answer this question

If anyone can spare the time to help my cbo prob

  • CWeeks

    For the comboBox you can either fill the Items collection with the items you want to display OR if you want to be databound you can set the DataSource property of the ComboBox. You can set your DataSource to a string array or if you have a datatable then you can set the DataSource to the DataTable and set the DisplayMember property of comboBox to a ColumnName of the DataTable.

    e.g.
    comboBox.DataSource = myStringArray;
    OR
    // Say you have a DataTable with a column called "Name"
    comboBox.DataSource = dataTable;
    comboBox.DisplayMember = "Name";

    The comboBox will now have all the entries in the Name column of the data table.

    Hope that helps.

    Thanks,
    -Dinesh Chandnani 

  • If anyone can spare the time to help my cbo prob