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

columns in grid being destroyed on init

Status
Not open for further replies.

Pollock

Programmer
Jun 2, 2000
49
CA
I have a formset which contains multiple forms. One of the forms contains a grid with 3 columns. When i go to run the form in debugging event list the forms all load, then right after the grid init

"formset1.grid_a1.grid_a1.Init()"

it hits the beforerowcolchange event, which is not called by program,

"formset1.grid_a1.grid_a1.BeforeRowColChange(1)"

it then immediately goes and does

formset1.grid_a1.grid_a1.column1.Destroy()
formset1.grid_a1.grid_a1.column1.text1.Destroy()
formset1.grid_a1.grid_a1.column1.header1.Destroy()

and destroys all the columns.

Just wanted to know if anybody had run across this before and if so how to fix it.

 
In all probability, the grids record source is empty. I have come across VFP grids not responding to views with no data loaded (the views will be empty when initialised, if no data loaded) and the grids taking on some other database than what is currently selected. To avoid this trap, I use the following in the forms load event assuming it is default data environment.
ThisForm.GridBase1.RecordSource = ALIAS()
This statement intialises the grid properly.

The point is - you test your grid by specifing the record source property explicitly again after the grid is initialised and do not assume the current alias to become the database for the grid.

Hope this helps you get out of the trap.

I have successfuly made this work around by properly taking care in my class construction. This trap exists in VFP!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top