Combo Box off by one

Hello everyone,

I have created a combo box, but I'm not sure why it's not working the way I would like it to.  I want it to change dynamically depending on what item the users put in.  I have code on the modified method of the item field in my grid which fills in the description of the item and then I want it to fill in the combo box with the warehouses it finds for that item.  It works in the sense that it finds the right warehouses but when I click on the combo box, it shows a blank, then the warehouses it found.  If I choose warehouse 1 and tab off it, the warehouse changes to warehouse 2.  If choose the blank and tab off it, it chooses warehouse 1.  So somehow something is off by 1.  Not sure what I'm doing wrong.  I've tried hard-coding the array size (like below) and I've also tried changing the array size dynamically but both have same result.  Here is the code:

public void modified()
{
    InventItemLocation              inventItemLocation;
    InventTable                     inventTable;
    InventDim                       inventDim;
    int                             i = 1;

    super();

    cboWarehouse.items(3);

    TCI_ReceivingLabels.ItemId = strUpr(TCI_ReceivingLabels.ItemId);
    TCI_ReceivingLabels.Name = InventTable::find(TCI_ReceivingLabels.ItemId).NameAlias;
    TCI_ReceivingLabels.NumOfLabels = 1;

    inventItemLocation = inventItemLocation::findDefault(TCI_ReceivingLabels.ItemId, false);

    while select * from inventItemLocation
        join inventDim
        where inventDim.inventLocationID != ''
        && inventDim.inventDimId == inventItemLocation.inventDimId
        && inventItemLocation.ItemId == TCI_ReceivingLabels.ItemId
        {
            cboWarehouse.item(i);
            cboWarehouse.text(inventdim.inventLocationID);
            i++;
        }
}

 

Anyone see what I'm doing wrong?

Parents Reply Children
Related
Recommended