'---Select----' is first items in all combobox!

prosys

Member
Joined
Aug 7, 2008
Messages
13
Programming Experience
Beginner
i using VB.Net to developing my application.
in forms i have comobox, in combobox datas are filled by using datasource from process layer.

i want '--Select--' is first items in all combobox. but i tried my ways, i cann't bring it.

any solution, pl share with me.

thanks in advance.
 
Since they're databound you cant simply do a ComboBox.Items.Insert(0, "--Select-") you'll have to modify the query to be a Union where the first Select statement is Select "--Select-" As FieldOne ....

That'll cause you to get "--Select-" as the first row in the dataset then the actual data following
 
Try adding the row to the DataTable then appending the data like this.

VB.NET:
Me.MyDataSet.MyDataTable.Clear()
Me.MyDataSet.MyDataTable.AddMyDataTableRow("--Select--")
Me.MyTableAdapter.ClearBeforeFill = False
Me.MyTableAdapter.Fill(Me.MyDataSet.MyDataTable)
Me.ComboBox1.SelectedIndex = 0
 
Back
Top