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

ComboBox in Grid: DisplayValue doesn't seem to work as expected

Status
Not open for further replies.

Rajesh Karunakaran

Programmer
Sep 29, 2016
549
MU
Hi friends,

This is quite simple but for the moment has become a bit weired it seems.

I have 2 tables:
base.dbf: company_id, person1name, person2name
company.dbf: company_id, company_name

I have grid with 3 columns Company Name, Person 1, Person 2.
In column1 (Company Name) I have ComboBox instead of the default TextBox.

The Combo rowsource is cursor made from company.dbf: company_name, company_id
Combo boundColumn is 2.

Grid column1 controlsource is bound to base.company_id

When the comboBox is active (in any row), it's the company name shown as desired.
But, for other records, how do we show the Company Name in the column (I don't have Company name in the base.dbf which is the base data for the grid).

Rajesh

 
Chriss,

Thank you.
I had not tried that. Otherwise also, I don't want to show combos in every row.
Now, I achieved the way I want it by creating another cursor and relating that to the base table.

This is solved!

Rajesh
 
Rajesh said:
I achieved the way I want it by creating another cursor and relating that to the base table.

Yes, that's also a solution, but then the column controlsource still is the company_id and not company_name, so you're overriding that? How does that effect the active cell when you activate the combobox?

I've done things like that not needing sparse by using DynamicCurrentControl. You still need to be cautious about how to set this up, in the case you want the combo the controlsource needs to be the column controlsource of company_id, in the control that's for inactive rows you will need to not bind to the column controlsource, so you only indirectly do so by the relation that's driven by the column controlsource. Otherwise, you can easily end up with quirks that sometimes work, sometimes not.

Chriss
 
Chris,

You're right, I changed the control source to Company Name. In this particular case, that was what required.

However, I certainly want to trial run what you have explained. In case, if I get stuck, I will get back here.

Thanks,
Rajesh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top