populate dropdownlist
-
hi ppl, i have a database with three columns namely first_name, second_name and third_name. and i want only the contents of first column i.e contents of first_name column to be displayed in a dropdownlist how do i do this. thanks and regards
-
hi ppl, i have a database with three columns namely first_name, second_name and third_name. and i want only the contents of first column i.e contents of first_name column to be displayed in a dropdownlist how do i do this. thanks and regards
by using the following code u will be able to add data from first_name: dim Cn as new adodb.connection dim rs as new adodb.recordset dim str as string cn.Open "DSN-NAME", "UID", "PWD" Set rS.ActiveConnection = cn str_State = "Select DISTINCT FIELD-NAME from TABLE-NAME" rs.Open str, cn, adOpenStatic, adLockReadOnly For j = 1 To rs.RecordCount cmbo1.AddItem rs.Fields(0).Value rs.MoveNext Next If rs.State = 1 Then rs.Close Set rs = Nothing End If If cn.State = 1 Then cn.Close Set cn = Nothing End If
-
hi ppl, i have a database with three columns namely first_name, second_name and third_name. and i want only the contents of first column i.e contents of first_name column to be displayed in a dropdownlist how do i do this. thanks and regards
Populate a dataset with data from the table containing the first_name columns.Then set the following properties of the combo-box(dropdown):- ComboBox1.datasource = name-of-dataset.Tables(0) ComboBox1.DisplayMember = "first_name" ComboBox1.ValueMember = "first_name"
-
hi ppl, i have a database with three columns namely first_name, second_name and third_name. and i want only the contents of first column i.e contents of first_name column to be displayed in a dropdownlist how do i do this. thanks and regards
You can do it at run time by using code Private myRow As DataRow Private myCol As DataColumn Private myTable As DataTable myCol = myTable.Columns(0) For Each myRow In myTable.Rows ComboSample.Items.Add(myRow(0)) Next or simply use comboBox1.DataSource=dataSet where dataset contains the required table. Lata Agrawal