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

Grid Control Read Only Question

Status
Not open for further replies.

bcoats

Programmer
Jun 20, 2001
49
0
0
US
I have a grid control with three columne that I am populating from an sql statement. I have the RecordSourceType set to 4 = SQL and this automatically sets the grid to read only. The problem I have is that I am populating columns 1 & 2 from that source and a combo box in the third column from another datatable that I am reading through to fill the combobox list. This box is supposed to allow the user to control mapping from cols 1 & 2 into the values in col 3 for a conversion routine. Since the grid has set itself to readonly, the combo box will not allow the value to be selected.

Another strange thing I have going on with this is that the combo box in col 3 is only visible when you click into the third column.

Any help on either or both of these issues you can give will be greatly appreciated.

Thanks
BCoats
 

Hi BCoats,

First, I agree with Dave's solution to your second problem. You need to set the column's Sparse property to .F. in order to see the control in every row.

Rather than using a SQL statement to populate the grid, I suggest you execute the SQL statement separately, sending the results to a cursor. Then use the cursor to populate the grid. That way, you will be able to set the ReadOnly properties of the individual columns in any way you please.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

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

You may find it helpful to download this session from my website:

How to Put a Combo Box in a Grid as Presented by Marcia G. Akins at GLGDW 2000

This session covers all aspects of using combo boxes inside grids. The combo box is a very useful control when you need to limit the options that a user may select from, but it is not easy to use well in any situation, and inside a grid it sometimes seems to acquire a life of its own. I will show you how to add combo boxes to your grids and how to make them display and behave properly. We will also cover how to use a view as the grid's RecordSource as well as the easiest and most effective way to use an updateable cursor as the grid's RecordSource. The session finishes by showing some really cool things you can do with a combo in a grid.


Marcia G. Akins
 
thanks. the sparce property did correct the problem I was having with the combo boc not showing. However, I am still unable to select anything from the combobax because it grid control it still read only. I am now selecting the SQL into a cursor and useing that as my datasource for the grid control. Any other suggerstions?

thanks, BCoats
 
I am now selecting the SQL into a cursor and useing that as my datasource for the grid control.

Are you selecting INTO CURSOR MyCursor RAEDWRITE?

Also, are you qualifying the ControlSources of the grid columns with the alias specified as its RecordSOurce? If you use only the field names as the ControlSources for the columns this has the effect of making the column ReadOnly.



Marcia G. Akins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top