Page 1 of 1

populating combo box from code

Posted: Thu Apr 15, 2010 8:21 am
by scot
Hi,

I have a combo box on an options form contained in the report. I can set the (Data Bindings) Items property and the combo box loads fine when loading. What I need to do is load the combo box from code after the form is displayed, I've tried using: this.cboEmployee.ItemsBinding = "CompanyEmployee.Employee_Name"; where CompanyEmployee is a datasource and Employee_Name is a field in that datasource, but it does nothing. Is there a DataBind or DataRefresh function I should be calling? How do I do this?

Thanks,
Scot

populating combo box from code

Posted: Fri Apr 16, 2010 1:19 am
by Jan
Hello Scot,

Try to use following code:

Code: Select all

CompanyEmployee.First();
while (!CompanyEmployee.IsEof)
{
  cboEmployee.Control.Items.Add(CompanyEmployee.Employee_Name);
  CompanyEmployee.Next();
}
Thank you.