D
David R
Hi,
This would seem to be a variation on a well known issue
with .NET Windows Forms Combo Boxes, however, I was
wondering if anyone has had any success with it in the
mean time.
I have a combo box which I data bind in the Form_Load
event. The 1st item in the data source is selected.
However, for my purposes, the combo box should have no
selected item. Setting the SelectedIndex property to -1
has no effect. The 1st item is still selected. Here is my
code :
private void JobViewWinForm_Load(object sender,
System.EventArgs e)
{
....
// Populate Job Status Combo. Deselect item.
DataSet __JobStatusDataSet =
JobBusinessObject.RetrieveJobStatus();
jobStatusComboBox.DataSource =
__JobStatusDataSet.Tables[0];
jobStatusComboBox.ValueMember = "JobStatusID";
jobStatusComboBox.DisplayMember = "Description";
jobStatusComboBox.SelectedIndex = -1;
// Setup DataGrid - Do search for all jobs.
//Search();
....
}
I would like to have the combo box unselected,
particularly, because the Search method looks at the combo
to see if anything is selected. But, of course, on
Form_Load, nothing should be.
Thanks,
David.
This would seem to be a variation on a well known issue
with .NET Windows Forms Combo Boxes, however, I was
wondering if anyone has had any success with it in the
mean time.
I have a combo box which I data bind in the Form_Load
event. The 1st item in the data source is selected.
However, for my purposes, the combo box should have no
selected item. Setting the SelectedIndex property to -1
has no effect. The 1st item is still selected. Here is my
code :
private void JobViewWinForm_Load(object sender,
System.EventArgs e)
{
....
// Populate Job Status Combo. Deselect item.
DataSet __JobStatusDataSet =
JobBusinessObject.RetrieveJobStatus();
jobStatusComboBox.DataSource =
__JobStatusDataSet.Tables[0];
jobStatusComboBox.ValueMember = "JobStatusID";
jobStatusComboBox.DisplayMember = "Description";
jobStatusComboBox.SelectedIndex = -1;
// Setup DataGrid - Do search for all jobs.
//Search();
....
}
I would like to have the combo box unselected,
particularly, because the Search method looks at the combo
to see if anything is selected. But, of course, on
Form_Load, nothing should be.
Thanks,
David.