[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

How to use code to add items to a combo box

jxiang

10/3/2005 4:29:00 PM

I was wondering if any one could point me in the right direction.

I have two combo boxes and need to fill the second with values that are
determined by the selection from the first. In the first combo box the
values are field names in a table. The values that are to populate the second
are the unique values of a field from the table. The field name is determined
by the selection in the first combo box.

My question is:what method could I use to add items ( unique values of a
table field ) to the second combobox when I make a selection from the first
combobox.

Thanks

Jack
1 Answer

Simon Agerbo

10/4/2005 7:35:00 AM

0

Hi Jack

The method to add items to a combobox is called Add(<stringValue>)

In order to get unique fieldvalues of a field, you could use a "group by"
statement on that field.

ex. Get unique fieldvalues from field "Salesline.ItemId" and add them to a
combobox named combobox2

Salesline locSalesline;
combobox2.clear(); //combobox must be autodeclared on form

while SELECT locSalesline group by ItemId
{
combobox2.add(locSalesline.itemid);
}

To fill combobox2 with new values when changing combobox1, you should
override the method SelectionChange() on combobox1.

Hopefully this can bring you further.

Best regards

Simon Agerbo



"jxiang" wrote:

> I was wondering if any one could point me in the right direction.
>
> I have two combo boxes and need to fill the second with values that are
> determined by the selection from the first. In the first combo box the
> values are field names in a table. The values that are to populate the second
> are the unique values of a field from the table. The field name is determined
> by the selection in the first combo box.
>
> My question is:what method could I use to add items ( unique values of a
> table field ) to the second combobox when I make a selection from the first
> combobox.
>
> Thanks
>
> Jack