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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creation of ComboBox inside Grid at runtime

Status
Not open for further replies.

Nro

Programmer
May 15, 2001
337
CA
Hi all.

I have a form with a grid, linked to a table. I want to create some combobox at runtime, because the combo can be on one of the 12 column, and it's never the same column. So, I have put some code in the INIT of the grid to add the combo and populate it ;

WITH THIS

.Column5.ControlSource = "fac_hd01.id_inv_po"
.Column5.AddObject("othControl","combobox")
.Column5.CurrentControl = "othControl"

.Column5.othControl.AddItem("Comm. future")
.Column5.othControl.AddItem("Comm. du client")
.Column5.othControl.AddItem("Facture")
.Column5.othControl.AddItem("Note de crédit")
.Column5.othControl.AddItem("Informations")
.Column5.othControl.AddItem("Retours")
.Column5.othControl.AddItem("Echantillons")
.Column5.othControl.AddItem("Comm. Ouverte")

.Column5.Sparse = .F.

ENDWITH

I received no error, but the column with the combo appears grayed. If I drop a combo control in the form, everything is working fine, but I don't want to put a control for each column, just in case...

I search in thread for this problem, but did not find anything. Working with VFP 9.0 Sp2

Thanks in advance.

Nro

 
1. You need to make your control visible using visible = .t. By default all controls added in run-time added invisible.

2. You may also want to remove the original textbox (though this is unnecessary).
 
Hey, thanks for the quick answer. It's working.

Nro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top