Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem Refreshing Grid on Form
Message
 
À
18/07/2002 16:45:48
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00680117
Message ID:
00680218
Vues:
23
Tracy;

Before changing a record source to a grid you must assign either = “” or = Space(0) as the record source value.

If the record source is redefined after this there is no problem. However, you have observed the problem if this rule is not applied. The grid and all your work defaults to a base condition or is destroyed.

Give me the Grid any day over a Browse! :)

Tom

>YES, YES, YES! But why does emptying the value of the recordsource property BEFORE requerying (instead of AFTER like I was doing) prevent the grid from having to be rebuilt? I'm so happy it works! Thanks Tom!
>
>Tracy
>
>>>I have a grid (grid1) on a form. It's recordsource is a table that is created useing a sql statement in the form's load event. I have set up special column headings and comboboxes as the grid's controls to ease updates.
>>>
>>>I have an option group that will allow the user to change the records in the grid (by issuing a new select statement).
>>>
>>>When the form loads, the grid is populated as it should be and udpates occur as they should.
>>>
>>>However, when the user clicks on any of the options in the option group to change the select statement, the grid is repopulated as it should be, but it also goes to a 'generic' grid that does not contain my column headings, special controls in each column, etc. Why is this happening? Any ideas are greatly appreciated!
>>>
>>>Here is the initial population of the grid in the form's load that works correctly (grid is displayed correctly with appropriate controls, etc and update works):
>>>
>>>
>>>*Form Load
>>>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
>>>  WHERE lcontrol.cn_name IN ;
>>>       (SELECT ctrlname FROM ctrlset WHERE UPPER(ALLTRIM(ctrlset.ctrlname))="CONTRACT");
>>>       INTO TABLE (hdir+"TEMPLCONTROL.DBF")
>>>
>>>
>>>Here is the code in one of the options of the option group that populates the grid and the table has the correct records, but the grid is now a generic grid and not the one on the form I customized:
>>>
>>>
>>>*option 1 of option group
>>>USE IN templcontrol
>>>SELE 0
>>>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
>>>  WHERE UPPER(ALLTRIM(lcontrol.cn_name))="RECEIPT" ;
>>>  INTO TABLE (hdir+"TEMPLCONTROL.DBF")
>>>SELE TEMPLCONTROL
>>>PRIVATE lSuccess
>>>lSuccess=CURSORSETPROP("Buffering", 5, "TEMPLCONTROL")
>>>IF lSuccess != .T.
>>>   =MESSAGEBOX("ERROR! Could not set buffering mode on temporary table!",0,"Please exit this form and try again.")
>>>ENDIF
>>>THISFORM.GRID1.RECORDSOURCE=""
>>>THISFORM.GRID1.RECORDSOURCE='TEMPLCONTROL'
>>>THISFORM.GRID1.REFRESH()
>>>
>>>
>>>Thanks all for your help!
>>>Tracy
>>
>>
>>Tracy;
>>
>>Will this work?
>>
>>
>>*option 1 of option group
>>THISFORM.GRID1.RECORDSOURCE=""
>>
>>USE IN templcontrol
>>SELE 0
>>SELECT cn_name, cn_port, cn_printer FROM lcontrol ;
>>  WHERE UPPER(ALLTRIM(lcontrol.cn_name))="RECEIPT" ;
>>  INTO TABLE (hdir+"TEMPLCONTROL.DBF")
>>SELE TEMPLCONTROL
>>PRIVATE lSuccess
>>lSuccess=CURSORSETPROP("Buffering", 5, "TEMPLCONTROL")
>>IF lSuccess != .T.
>>   =MESSAGEBOX("ERROR! Could not set buffering mode on temporary table!",0,"Please exit this form and try again.")
>>ENDIF
>>THISFORM.GRID1.RECORDSOURCE='TEMPLCONTROL'
>>THISFORM.GRID1.REFRESH()
>>
>>
>>Tom
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform