Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selected item from a combo box to the cell in a grid

Status
Not open for further replies.

Jomercat

Programmer
Sep 1, 2004
100
US
Hi all,

I added a combo box to a grid which is displaying a list of items. What I need to do is to select the item from the combo, hide the combo box, and place the selected item on the same cell where the combo box is.

Help please!!!!!

Jose.
 

Jose,

Place the combo and an ordinary textbox in the same column of the grid. In the combo's InteractiveChange, set a form property to say that an item has been selected.

In the grid column's Init, set the column's DynamicCurrentControl property to an IIF() expression. The expression should say that if the form property is true, make the textbox the current control, otherwise make the combo box current. See the Help for DynamicCurrentControl for more details.

The above is just an outline, but is should get you started.

I'm not sure how you plan to reveal the combo box again.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
I presume you deleted the textbox from the grid when you added the combo box. If you'd left the textbox in place then you could have used DynamicCurrentControl to decide whether the combo or the text box was visible.

Geoff Franklin
 
Thank you both for your reply!!!

MikeLewis- What is the "form property" that you refer to?

Could you provide a sample code?

alvechurchdata- I kept the textbox.

Thanks.

Jose.
 

Jose,

A form property is a property that you add to the form. To do so, go to the Form menu (in the Form designer) and select New Property.

The point about a form property is that it's available to all the code in the form -- a sort of semi-public variable. To reference it in your code, you need to precede its name with THISFORM.

I suggest you spend a bit of time reading the Help file re properties and scope before you go much further.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
MikeLewis,

Thanks for your help.

I was not sure if you were refering to adding a form "form property". I added it and will try your suggestion.

Thanks.

Jose.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top