
Click Apply and Exit to close the Spread Designer. This opens the String Collection Editor dialog box, where you can enter the values one at a line.Select the cell type and any other cell properties.Select the SetCellType icon under the CellType section.In the work area, select the cell or cells for which you want to set the cell type.

( new )ĭim c As New ĭim al As New ArrayList(ds.Tables(0).Rows.Count)įpSpread1.Sheets(0).Cells(1, 1).CellType = c dim mycon as new sqlconnection('connectionstring') mycon.open() dim da as new sqldataadapter('select from table1',mycon) dim dt as datatable da.fill(dt) combobox1.datasource dt combobox.displaymember 'field name you want to show ' combobox. Use a datatable and use the DataView.ToTable with the distinct option. This example creates a string array and adds the items to the combo cell. Use a datatable and fill it with a Distinct clause in the SQL transact. Assign the combo box cell type to a cell (or cells).Specify any properties for that cell (or cells).Assign the list of items to a cell (or cells) defined as a combo box cell(s).Specify the items in the list that appear as part of the combo box.
#VISUAL BASIC DATA TABLE TO COMBOBOX HOW TO#
Define a combo box cell type by creating an instance of the ComboBoxCellType class. net tutorial: How to populate combobox from different tables in sql server database - YouTube.To create a cell that acts like a combo box, follow the procedure described here.įor details on the properties and methods for this cell type, refer to the ComboBoxCellType class in the Assembly Reference. The combo box cell can be bound to data by setting the DataSource, DataSourceID, DataMember, DataTextField, or DataValueField property. You can customize the appearance of the drop‑down list as well as its behavior.

The user may either type in the editable box (which searches for the item in the list) or select an item from the drop‑down list. A combo box cell displays an editable type box with a drop‑down list of items when the cell is selected.
