populating combo box from code

Stimulsoft Reports.NET discussion
Post Reply
scot
Posts: 7
Joined: Tue Feb 16, 2010 12:30 pm

populating combo box from code

Post 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
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

populating combo box from code

Post 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.
Post Reply