Combo.Text Question **Urgent**

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it just me or if you are loading a combo box and then choose one of its items, you can never clear the ComboBox.Text

with anything like....
cbRep.Text
cbRep.Text = cbRep.SelectedIndex(0)

without actually clearing and reloading the combo.
Is that a limitation of CF or is there a workaround to reduce the SQLCE overhead.
 
We solved this by adding an empty string item at the beginning of the combo
box.

marcmc said:
Is it just me or if you are loading a combo box and then choose one of its
items, you can never clear the ComboBox.Text
with anything like....
cbRep.Text
cbRep.Text = cbRep.SelectedIndex(0)

without actually clearing and reloading the combo.
Is that a limitation of CF or is there a workaround to reduce the SQLCE
overhead.
 
Thanks
I was thinkin of doing exactly that but how do you set the ComboBox.Text
to be equal to the blank at the 1st inde

Do you have the command please?
 
For comboboxes bound to datasources insert an item into the datasource prior
to setting the DataSource property.
If the datasource is a datatable use:

// Populate data table, e.g. from a DataAdapter or otherwise
DataRow row = myDataTable.NewRow();
// Set row values here
myDataTable.Rows.InsertAt(row, 0);
myCombo.DataSource = myDataTable


And please, do not add "Urgent" to the subject - it would only cause people
who might have helped otherwise to ignore the question
 
Well if you want that initially nothing should be selected in the
combo box. Try doing this

myCombo.SelectedIndex = -1

this will be empty selected by default.

Anamika
 
Back
Top