Click here to Skip to main content
14,696,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends

I want to make a addin for my outlook 2007/2010 with combobox, i need to inseret a dataset into combobox but its not possible.

i have tried many many things but no luck, so now i want to ask the experts.

SqlDataAdapter da = new SqlDataAdapter(cmd);
//   DataRow dr;// = new DataRow();
foreach (DataRow dr in ds.Tables[0].Rows)
    combobox.value ="customer id";
    combobox.text = "customername";

i hope i can help.

Updated 21-Feb-11 11:15am
Dave Kreskowiak 21-Feb-11 16:37pm
Your code doesn't make any sense. It seems that you have no idea how to bind a combo to a data source. First, you don't have to do anything with the rows of your table. You just need to set the combos DataSource property to the table you want (ds.Tables[0]). Then you have to tell the combo what to show and what to return from the selected value. This is covered by the DisplayMember and ValueMember properties of the combo. Set those to the names of the columns in the table and your all set.
Burim Rama 22-Feb-11 4:08am
Hello Dave

If you know somthing about ribbon (outlook addins) that you shouldt know at combox has no Properties to bind it with Dataset, no combox1.DataSource = ds.Tabels[0]; , soo this "It seems that you have no idea how to bind a combo to a data source" it seems to be you.
Thanks any way

1 solution


I think the code below should help you out!

SqlDataAdapter da = new SqlDataAdapter(cmd);

combobox.DisplayMember = "customername";
combobox.ValueMember = "customer id"
combobox.DataSource = ds.Tables[0]; // Or which ever table in your dataset

Good luck!


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900