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!

How to use the grid control? 1

Status
Not open for further replies.

shelbytll

Programmer
Dec 7, 2001
135
SG
I would like to display all the database field values in a grid control upon selection of a combo box. And user is allow to modify the values. When click on a button to submit the changes, the changes will be updated to the database.

So how do I:
1. Get the Grid Control to display out the field values using an Alias? Will be performing a select statment and store in cursor. What do I do from there?

2. Update the changes back to the databases upon submit. I am a clever newbie...[peace]
 
use the view designer and select the sendupdates in the designer.

assign the view as the recordsource to the grid.
Attitude is Everything
 
I have a view call view1.
so when I click on a combo box, i want the the recordsource of the grid to be view1.
How do I do that?
I tried: thisform.grid1.recordsource=view1
but it didn't work I am a clever newbie...[peace]
 
Ok I found out. Thanks

Another problem though.

How do I filter or requery the grid after I've made my selection on the combo box? I am a clever newbie...[peace]
 
Ermmm ok I found that out. I did:
select type1,type2,cvalue from info where brand=b and model=m order by type1,type2 into cursor tempcur
thisform.grid1.recordsource="tempcur"

BTW, when I try to edit the value, it didn't allow me to. The status bar shows read only. What should I do? I am a clever newbie...[peace]
 
HI Shelbytll,

select type1,type2,cvalue from info where brand=b and model=m order by type1,type2 into cursor tempcur

the cursor tempcur created here is read only. If you want to make this readwrite..

select type1,type2,cvalue from info where brand=b and model=m order by type1,type2 into DBF tempcur

This will make it readwrite. But remember to delete the tempcur after the purpose is over.

If you are using VFP7 then.. you can use..
SELECT type1,type2,cvalue from info where brand=b and model=m order by type1,type2 into cursor tempcur READWRITE

Hope this helps you :)
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
How do I delete the tempcur? I am a clever newbie...[peace]
 
shelbytll

How do I delete the tempcur?

tempcur is a cursor (temporary table), you don't have to delete it, it recreates itself once you redo your SQL or it goes away once you close to form Mike Gagnon
 
HI Shelbytll,

If it is cursor.. no need to delete.

If it is file.. I would always create it this way..

tempCur = SYS(3)

select type1,type2,cvalue from info where brand=b and model=m order by type1,type2 into DBF (tempcur)

After finishing my work... to delete the file..

DELETE FILE tempcur+".DBF"
DELETE FILE tempcur+".FPT"

Hope this helps you :)

ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Hi,
if I select from a table manually, without using the VIEW designer, it doesn't update, it doesn't have the "Send Update". WHat should I do? I am a clever newbie...[peace]
 
My VIEW contain 4 fields.
However, I want my grid to show only 2 fields.
How do I achieve that? Thanks

My code is:

public b1
b1=thisform.brand.value
public m1
m1=thisform.model.value
select view1
set filter to brand=b1
set filter to model=m1
locate
thisform.grid1.recordsource="view1"
I am a clever newbie...[peace]
 
HI Shelbytll,

thisform.grid1.ColumnN.WIdth = 0
for the columns you dont want can solve the issue.

OR
if the first 2 fields are required..
ThisForm.Grid1.ColumnCount = 2
cando that for you..

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top