Page 1 of 1

Unexpected ComboBox behavior - Web vs Desktop

Posted: Tue Mar 03, 2009 5:21 pm
by fuhrj
I'm having problems manually inserting an item into a combox after it is populated by my DataSource.

It works fine in Preview Mode, but when the report is viewed in Web Viewer, the inserted item does not show up.

The following code appears in the LoadForm Event

Code: Select all

ContractStatusTable.Connect();

lstStatus.Items.Insert(0, "All");
lstStatus.SelectedIndex = 0;
The Combo Box is databound.

My theory is that this event fires just before the table is populated. The reason I suggest this is that if I try to insert the item at any point other than 0, I get an index out-of-bands error.

If I remove the databinding and just add items to the collection, the above code works.


Unexpected ComboBox behavior - Web vs Desktop

Posted: Mon Mar 09, 2009 8:57 am
by Edward
Hi Fuhrj,

Please add all items 'by hand' from the ContractStatusTable data source after the Connect command:

Code: Select all

ContractStatusTable.Connect();
ContractStatusTable.DataTable.First();
while (!ContractStatusTable.DataTable.IsEof)
{
  lstStatus.Items.Add(ContractStatusTable.DataTable["MyColumn"].ToString());
  ContractStatusTable.DataTable.Next();
}
Thank you.