DataTable tbl = new DataTable(); tbl.Columns.Add("code", System.Type.GetType("System.String")); tbl.Columns.Add("desc", System.Type.GetType("System.String")); tbl.Columns.Add("other1", System.Type.GetType("System.String")); tbl.Rows.Add("aaa", "the a thing", ""); tbl.Rows.Add("code2", "code #2", ""); tbl.Rows.Add("code3", "code #3", ""); tbl.Rows.Add("code4", "code #4", "just a code"); tbl.Rows.Add("widget", "some sort of device", ""); tbl.Rows.Add("code5", "code #5", ""); tbl.Rows.Add("rush", "awesome rock group", ""); tbl.AcceptChanges(); //these are required dataCombobox1.TblData = tbl; dataCombobox1.ValueColumn = "code"; dataCombobox1.SetText("widget"); //these are optional //by default you will see all the columns in your table //use ColumnNameList to make it show just certain columns //this is a pipe delimited list dataCombobox1.ColumnNameList = "code|desc"; //use ColumnHeaderList to define the text that show in the column headers dataCombobox1.ColumnHeaderList = "Code|Description"; //you can control the width of the columns dataCombobox1.WidthList = "50|200"; //you can control the width and height of the grid dataCombobox1.PopupWidth = 300; dataCombobox1.PopupHeight = 200; |