Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VERY frustrated with Grid behavior. This should work.
Message
 
To
23/03/1998 02:42:27
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00086298
Message ID:
00086303
Views:
25
>Hi,
>
>I have a form in VFP5a that has a grid on it, which has 3 columns and in the 3rd column there is a checkbox. The first works great when it is first instantiated. However I have a pulldown box that allows the user the choose a different table to populate the grid with. When they change tables for some reason, the grid gets all messed up, even though it's the exact same method that is being called when the form is first instantiated as when the user changes tables. When I say the grid gets messed up, I mean the columns go from 3 to 4 (which incidentally is how many columns there are in the resulting query, even though I only want to show 3 in the grid), the headings change from the headings I set at design time to the names of the result columns from the Select SQL statement, and the check box disappears and in it's place the logical field is shown with .F. in each field. WEIRD!!
>Any ideas???

Rick,

This one has been bantered about a thousand times. When you issue your SELECT statement you rip the recordsource out from under the grid. Thsi acuases the grid to lose its mind.

The solution is to first blank the recorsource beroer you muck around with the grid's cursor.
 THISFORM.LockScreen = .T.
 THISFORM.Grid1.RecordSource = ""
 * Now do yor things with the select stuff

 * Now fix the grid
 WITH THISFORM.Grid1
     .RecordSource = "Whatever"
     .RecordSourceType = 1
     .ColumnCount = 3
     .Column1.Header.Caption = "Blah"
     .Column1.ControlSource = "Blah
     ...
 ENDWITH
 THISFORM.LockScreen = .F.
That should make your grid behave the way you want it to.
Previous
Reply
Map
View

Click here to load this message in the networking platform