Click to See Complete Forum and Search --> : How to change a control in a grid?
Hi folks,
I'm using grid to display the items related to an order. Item names are in
ItemDetail table and the Item ordered are in the itemorder table. Displaying
the info. in the textbox of a grid is fine. But problem arises when I want
to add or edit records in the grid. I want to use the combobox for the item
names. I have added the combobox as a control in that column as combo1. And
in combo1, orderitem.itemcode is the field and the sql statement is used
to get the itemnames from ItemDetail table as SELECT ALLT(itemdetail.name),
itemdetail.code FROM itemdetail INTO CURSOR cITEMCombo ORDER BY ItemDetail.name
. And also the column bound to 2.
This works fine when sparse = .F. but as I set the sparse = .T. it shows
me the itemcode, where I want is the item name.
I'm sorry, if I am bad in explaining the problem.
Amit
Larry Miller
01-26-2002, 09:04 AM
Check out the help topic for Sparse. If you don't specify it to .F., then
the Textbox control becomes the active control for all rows not current.
Since the underlying data is bound to itemcode, you will see this instead of
the name.
Why do you think you need to set it to .T.?
--
Larry Miller
MCSD, Microsoft MVP Visual FoxPro
Bifrost Solutions
"Amit" <maini_amit@yahoo.co.uk> wrote in message
news:3c52a327$1@10.1.10.29...
>
> Hi folks,
> I'm using grid to display the items related to an order. Item names are in
> ItemDetail table and the Item ordered are in the itemorder table.
Displaying
> the info. in the textbox of a grid is fine. But problem arises when I want
> to add or edit records in the grid. I want to use the combobox for the
item
> names. I have added the combobox as a control in that column as combo1.
And
> in combo1, orderitem.itemcode is the field and the sql statement is used
> to get the itemnames from ItemDetail table as SELECT
ALLT(itemdetail.name),
> itemdetail.code FROM itemdetail INTO CURSOR cITEMCombo ORDER BY
ItemDetail.name
> And also the column bound to 2.
> This works fine when sparse = .F. but as I set the sparse = .T. it shows
> me the itemcode, where I want is the item name.
> I'm sorry, if I am bad in explaining the problem.
> Amit
Hi Larry,
I want to use the combobox as a currentcontrol and don't want it to be active
by default. But on selection of Add or Edit command button this should be
active. Since I want to display the name of the items from the itemdetail
table and the grid is showing the ordereditems of a purchase order from orderitem
table. I can not keep it active in display mode. Hope u got the point.
Moreover, how can I define my own grid class without the textbox as a currentcontrol,
as in the grid samples program? Coz when I want to change the currentcontrol
Textbox remains there where as in sample program only the Checkbox is there
when I look at the properties. How come?
Amit
"Larry Miller" <LMiller3@bellatlantic.net> wrote:
>Check out the help topic for Sparse. If you don't specify it to .F., then
>the Textbox control becomes the active control for all rows not current.
>Since the underlying data is bound to itemcode, you will see this instead
of
>the name.
>
>Why do you think you need to set it to .T.?
>
>--
>Larry Miller
>MCSD, Microsoft MVP Visual FoxPro
>Bifrost Solutions
>
>
>"Amit" <maini_amit@yahoo.co.uk> wrote in message
>news:3c52a327$1@10.1.10.29...
>>
>> Hi folks,
>> I'm using grid to display the items related to an order. Item names are
in
>> ItemDetail table and the Item ordered are in the itemorder table.
>Displaying
>> the info. in the textbox of a grid is fine. But problem arises when I
want
>> to add or edit records in the grid. I want to use the combobox for the
>item
>> names. I have added the combobox as a control in that column as combo1.
>And
>> in combo1, orderitem.itemcode is the field and the sql statement is used
>> to get the itemnames from ItemDetail table as SELECT
>ALLT(itemdetail.name),
>> itemdetail.code FROM itemdetail INTO CURSOR cITEMCombo ORDER BY
>ItemDetail.name
>> And also the column bound to 2.
>> This works fine when sparse = .F. but as I set the sparse = .T. it shows
>> me the itemcode, where I want is the item name.
>> I'm sorry, if I am bad in explaining the problem.
>> Amit
>
>
devx.com
Copyright Internet.com Inc. All Rights Reserved