Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid and Requerying
Message
De
11/12/1999 18:10:47
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00302205
Message ID:
00302294
Vues:
27
>Hi.
>I am still grappling with a Grid problem and cannot find a resolution.
>Scene is as follows:
>
>1. I have set up a Grid on a search form which dispalys fields from a cursor based on a result set
>2. RecordSource Type =Alias recordSource = ' ', ColumnCount = 4
>3. In the Init of the grid, I have a method(SetColumns) which sets Column Sources,captions etc for each column
> e.g. .caption=MyCaption .RowSource=sma_name .FontName = 'Courier New'
> (I do it like this because each client needs different fileds..these are help on a paramter file)
>4. On My Search button , I have the following:
> ThisForm.MyGrid.RecordSource = ''
> Select * from MySourceFile into Cursor Mycursor
> ThisForm.MyGrid.RecordSource = MyCursor
>
>What happens is, the fields in the Grid, are not as per Point 3 above, but it is just showing the first 3 fields from the file
> (The Caption,Font,headers etc display correctly)
>
>If I call my SetColumns methos after point 4 above, I just get the first record from the
> result set displayed in EVERY row, but again with the incorrect columns.
>
>I've spent weeks trying to sort this out and would reaaly appreciate any help
>
>Regards,
>Gerard

Firstly, I believe that you use quotes. i.e. ThisForm.MyGrid.RecordSource = "MyCursor".
Secondly, let's try to sort things out. Normally, after you reset all column.controlsource and other grid setting you may issue Grid.Refresh. It's also small thing, but may help.
Another thing, I believe it will help, is to include Grid.ColumnCount= (use your number here) to SetColumns code.
There is one more thing, it's actually not necessary relevant to your case. Generally, it's not mandatory to reset Grid.Recordsource, if you collect records to your cursor differently. You may use read-write cursor (CREATE CURSOR in form.load event), select needed data to array and insert into cursor from this array. If your resordset is small that's the way. You will ZAP the cursor before each INSERT.
Edward Pikman
Independent Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform