G
Guest
I'm sure this is a fairly basic question, but I've been looking all over the
web for days for suggestions on how to do this.
I've got a datagrid that's bound to a dataset on my form. It includes
several columns, the last of which (with the header Quantity) contains int16
values. When a user selects a row, I would like to have a combobox on the
form display the values from 1 to the number in the Quantity column (e.g.,
the selected row has 4 in the quantity column, so the combobox would display
1,2,3,4 for it's items).
I think I can populate the combobox once I've gotten the value from the
Quantity column using something like this:
System.Object[] noBottles = new object[quantity];
for (int i= 1; i<= quantity+1; i++)
{
noBottles=i;
}
cmbNumberOfBottles.Items.AddRange(noBottles);
cmbNumberOfBottles.SelectedIndex[0];
where 'quantity' is the integer from the Quantity column, but for the life
of me I can't get that Quantity number into a useable int format for this.
I'm sure this comes across as Grade-A programming newbie (which I am), but
any help would be appreciated. Also, if my combobox populating method looks
screwy, any advice would be very helpful there as well.
Thanks so much in advance!
web for days for suggestions on how to do this.
I've got a datagrid that's bound to a dataset on my form. It includes
several columns, the last of which (with the header Quantity) contains int16
values. When a user selects a row, I would like to have a combobox on the
form display the values from 1 to the number in the Quantity column (e.g.,
the selected row has 4 in the quantity column, so the combobox would display
1,2,3,4 for it's items).
I think I can populate the combobox once I've gotten the value from the
Quantity column using something like this:
System.Object[] noBottles = new object[quantity];
for (int i= 1; i<= quantity+1; i++)
{
noBottles=i;
}
cmbNumberOfBottles.Items.AddRange(noBottles);
cmbNumberOfBottles.SelectedIndex[0];
where 'quantity' is the integer from the Quantity column, but for the life
of me I can't get that Quantity number into a useable int format for this.
I'm sure this comes across as Grade-A programming newbie (which I am), but
any help would be appreciated. Also, if my combobox populating method looks
screwy, any advice would be very helpful there as well.
Thanks so much in advance!