Page 1 of 1

Related List Boxes on Forms

Posted: Tue Jun 30, 2009 4:39 pm
by johnham
I have listbox#1 that I need to place lookup data in. Depending on the value selected I would like to refresh the data in listbox #2.

I have listbox #1 bound to the proper datasource and I have listbox #2 bound to a datasource that accepts an ID parameter from Listbox #1 but for the life of me I can't get listbox #2 to rebind the data in it so that it will see the new parameter I have passed to it as a filter.

I would like to find a way to do this purely using databinding and not with looping through the dataset for listbox #2 if possible.


Related List Boxes on Forms

Posted: Tue Jun 30, 2009 6:32 pm
by Edward
Hi John,

Is it a Web application or a Windows Forms application you are asking about?

Thank you.

Related List Boxes on Forms

Posted: Wed Jul 01, 2009 10:52 am
by johnham
WinForms

Related List Boxes on Forms

Posted: Fri Jul 03, 2009 9:16 am
by Jan
Hello Johnam,

You need sign to SelectedIndexChangedEvent of Listbox#1. In this event you need place code similar to:

Code: Select all

ListBoxControl1.Items.Clear();

Customers.First();
while (!Customers.IsEof)
{
  if (condition)
  {
    ListBoxControl1.Items.Add(Customers.CompanyName);
    Customers.Next();
  }
}
Thank you.

Related List Boxes on Forms

Posted: Fri Jul 03, 2009 9:41 am
by johnham
I was looking for a way to use databinding. Like bind ListBox1 to a datasource and listBox2 to a second dataset which has a parameter for filtering base on values selected in the first list box. Once something is selected I should be able to set the parameter and reload the listBox2 or rebind listbox2 to its datasource.


Related List Boxes on Forms

Posted: Mon Jul 06, 2009 7:18 am
by Jan
Hello,

Unfortunatelly report engine does not have tools to rebind data.

Thank you.