I have a container class that contains a grid. The grid was setup to have
specific column names. I set the grid to point to a cursor during runtime.
This allows me the ability to have multiple instances of the container using
different cursors. The container is loaded onto a form at runtime as the
user needs this interface. The code below is my standard way of "binding"
the data to the grid.

cTempFile1 = "somecursor"
this.Grid_Codes.recordsource = 1 && Alias
this.Grid_Codes.recordsource = cTempFile1
this.Grid_Codes.col_code.controlsource = cTempFile1 + ".cCode"
this.Grid_Codes.col_desc.controlsource = cTempFile1 + ".cDesc"

The problem I am having is, sometimes (hard to repeat), I get errors because
the code is referring to the col_code column. VFP errors out stating
"Unknown member COL_CODE".
It turns out, that the grid has lost the names of the grid, and now has the
names Column1 and Column2 instead of col_code and col_desc.

Has anyone else seen this problem, and does anyone have a resolution?

Thanks,
Dan Tallent

RE: VFP 8: Grids (bug problem) by Devers

Devers
Fri Jun 24 08:11:03 CDT 2005

Dan-

1) Make sure the Grid_Codes.RecordSource property is empty at design time.
2) Always clear the RecordSource before you re-create "somecursor" and then
afterwards, re-bind the grid using your standard code.

Hope that helps!

"Dan Tallent" wrote:

> I have a container class that contains a grid. The grid was setup to have
> specific column names. I set the grid to point to a cursor during runtime.
> This allows me the ability to have multiple instances of the container using
> different cursors. The container is loaded onto a form at runtime as the
> user needs this interface. The code below is my standard way of "binding"
> the data to the grid.
>
> cTempFile1 = "somecursor"
> this.Grid_Codes.recordsource = 1 && Alias
> this.Grid_Codes.recordsource = cTempFile1
> this.Grid_Codes.col_code.controlsource = cTempFile1 + ".cCode"
> this.Grid_Codes.col_desc.controlsource = cTempFile1 + ".cDesc"
>
> The problem I am having is, sometimes (hard to repeat), I get errors because
> the code is referring to the col_code column. VFP errors out stating
> "Unknown member COL_CODE".
> It turns out, that the grid has lost the names of the grid, and now has the
> names Column1 and Column2 instead of col_code and col_desc.
>
> Has anyone else seen this problem, and does anyone have a resolution?
>
> Thanks,
> Dan Tallent
>
>
>
>

Re: VFP 8: Grids (bug problem) by christophe

christophe
Fri Jun 24 08:48:49 CDT 2005

Dan,

I have similar grids which I've been using in different ways.
(One or more grids on 1 form, or one or more grids on multiple forms.)
and I always code them something like this without any trouble.

myform.addobject("mygrid","mygridclass",youralias)
myform.gridpapyrus.visible = .t.

*in Mygridclass init
Procedure Init
Lparameters calias
Select (calias)
This.RecordSource = calias
With This.column1
.ControlSource = [reknr] &&not &calias..reknr as this was sometimes buggy.
....
endwith

or slightly different with adding collums if necessary
Procedure Init
Lparameters calias
Select (calias)
This.RecordSource = calias
This.AddObject("mycolumn1","SomeColumnClass")
With This.mycolumn1
.ControlSource = [trlnr]
endwith
...

hope this helps
regards
christophe
--
\|||/
(o o)
----ooO-(_)-Ooo-------------


"Dan Tallent" <dtallent@NOTEarthlink.net> schreef in bericht
news:%23gES$nLeFHA.2664@TK2MSFTNGP15.phx.gbl...
>I have a container class that contains a grid. The grid was setup to have
> specific column names. I set the grid to point to a cursor during
> runtime.
> This allows me the ability to have multiple instances of the container
> using
> different cursors. The container is loaded onto a form at runtime as the
> user needs this interface. The code below is my standard way of "binding"
> the data to the grid.
>
> cTempFile1 = "somecursor"
> this.Grid_Codes.recordsource = 1 && Alias
> this.Grid_Codes.recordsource = cTempFile1
> this.Grid_Codes.col_code.controlsource = cTempFile1 + ".cCode"
> this.Grid_Codes.col_desc.controlsource = cTempFile1 + ".cDesc"
>
> The problem I am having is, sometimes (hard to repeat), I get errors
> because
> the code is referring to the col_code column. VFP errors out stating
> "Unknown member COL_CODE".
> It turns out, that the grid has lost the names of the grid, and now has
> the
> names Column1 and Column2 instead of col_code and col_desc.
>
> Has anyone else seen this problem, and does anyone have a resolution?
>
> Thanks,
> Dan Tallent
>
>
>



Re: VFP 8: Grids (bug problem) by Dan

Dan
Fri Jun 24 10:01:01 CDT 2005

1. The Recordsource of the Grid is set to "(None)" Is this what you mean
by empty?
2. When you say clear, would the code read:
this.Grid_Codes.recordsource = ""

Thanks again
Dan




"Devers" <Devers@discussions.microsoft.com> wrote in message
news:791882FB-3B39-4E62-8E9F-549D0697F76D@microsoft.com...
> Dan-
>
> 1) Make sure the Grid_Codes.RecordSource property is empty at design time.
> 2) Always clear the RecordSource before you re-create "somecursor" and
then
> afterwards, re-bind the grid using your standard code.
>
> Hope that helps!
>
> "Dan Tallent" wrote:
>
> > I have a container class that contains a grid. The grid was setup to
have
> > specific column names. I set the grid to point to a cursor during
runtime.
> > This allows me the ability to have multiple instances of the container
using
> > different cursors. The container is loaded onto a form at runtime as
the
> > user needs this interface. The code below is my standard way of
"binding"
> > the data to the grid.
> >
> > cTempFile1 = "somecursor"
> > this.Grid_Codes.recordsource = 1 && Alias
> > this.Grid_Codes.recordsource = cTempFile1
> > this.Grid_Codes.col_code.controlsource = cTempFile1 + ".cCode"
> > this.Grid_Codes.col_desc.controlsource = cTempFile1 + ".cDesc"
> >
> > The problem I am having is, sometimes (hard to repeat), I get errors
because
> > the code is referring to the col_code column. VFP errors out stating
> > "Unknown member COL_CODE".
> > It turns out, that the grid has lost the names of the grid, and now has
the
> > names Column1 and Column2 instead of col_code and col_desc.
> >
> > Has anyone else seen this problem, and does anyone have a resolution?
> >
> > Thanks,
> > Dan Tallent
> >
> >
> >
> >



Re: VFP 8: Grids (bug problem) by Jack

Jack
Fri Jun 24 12:24:03 CDT 2005

On Fri, 24 Jun 2005 08:42:51 -0400, "Dan Tallent"
<dtallent@NOTEarthlink.net> wrote:

>I have a container class that contains a grid. The grid was setup to have
>specific column names. I set the grid to point to a cursor during runtime.
>This allows me the ability to have multiple instances of the container using
>different cursors. The container is loaded onto a form at runtime as the
>user needs this interface. The code below is my standard way of "binding"
>the data to the grid.
>
>cTempFile1 = "somecursor"
>this.Grid_Codes.recordsource = 1 && Alias
>this.Grid_Codes.recordsource = cTempFile1
>this.Grid_Codes.col_code.controlsource = cTempFile1 + ".cCode"
>this.Grid_Codes.col_desc.controlsource = cTempFile1 + ".cDesc"
>
>The problem I am having is, sometimes (hard to repeat), I get errors because
>the code is referring to the col_code column. VFP errors out stating
>"Unknown member COL_CODE".
>It turns out, that the grid has lost the names of the grid, and now has the
>names Column1 and Column2 instead of col_code and col_desc.
>
>Has anyone else seen this problem, and does anyone have a resolution?

This is standard grid behavior.

If you recreate the grid's record source, all of the columns are
removed and replaced. To avoid this, set the grid's RecordSource to
empty ('') before rebuilding the cursor, then set it back.


Re: VFP 8: Grids (bug problem) by Devers

Devers
Fri Jun 24 13:11:02 CDT 2005

1) Yes.
2) Yes.

"Dan Tallent" wrote:

> 1. The Recordsource of the Grid is set to "(None)" Is this what you mean
> by empty?
> 2. When you say clear, would the code read:
> this.Grid_Codes.recordsource = ""
>
> Thanks again
> Dan
>
>
>
>
> "Devers" <Devers@discussions.microsoft.com> wrote in message
> news:791882FB-3B39-4E62-8E9F-549D0697F76D@microsoft.com...
> > Dan-
> >
> > 1) Make sure the Grid_Codes.RecordSource property is empty at design time.
> > 2) Always clear the RecordSource before you re-create "somecursor" and
> then
> > afterwards, re-bind the grid using your standard code.
> >
> > Hope that helps!
> >
> > "Dan Tallent" wrote:
> >
> > > I have a container class that contains a grid. The grid was setup to
> have
> > > specific column names. I set the grid to point to a cursor during
> runtime.
> > > This allows me the ability to have multiple instances of the container
> using
> > > different cursors. The container is loaded onto a form at runtime as
> the
> > > user needs this interface. The code below is my standard way of
> "binding"
> > > the data to the grid.
> > >
> > > cTempFile1 = "somecursor"
> > > this.Grid_Codes.recordsource = 1 && Alias
> > > this.Grid_Codes.recordsource = cTempFile1
> > > this.Grid_Codes.col_code.controlsource = cTempFile1 + ".cCode"
> > > this.Grid_Codes.col_desc.controlsource = cTempFile1 + ".cDesc"
> > >
> > > The problem I am having is, sometimes (hard to repeat), I get errors
> because
> > > the code is referring to the col_code column. VFP errors out stating
> > > "Unknown member COL_CODE".
> > > It turns out, that the grid has lost the names of the grid, and now has
> the
> > > names Column1 and Column2 instead of col_code and col_desc.
> > >
> > > Has anyone else seen this problem, and does anyone have a resolution?
> > >
> > > Thanks,
> > > Dan Tallent
> > >
> > >
> > >
> > >
>
>
>

Re: VFP 8: Grids (bug problem) by Dan

Dan
Mon Jun 27 06:00:25 CDT 2005

Thanks,
I'll give it a try today.

Thx again,
Dan Tallent


"Devers" <Devers@discussions.microsoft.com> wrote in message
news:C3944549-994F-4457-B1FF-265C091BA265@microsoft.com...
> 1) Yes.
> 2) Yes.
>
> "Dan Tallent" wrote:
>
> > 1. The Recordsource of the Grid is set to "(None)" Is this what you
mean
> > by empty?
> > 2. When you say clear, would the code read:
> > this.Grid_Codes.recordsource = ""
> >
> > Thanks again
> > Dan
> >
> >
> >
> >
> > "Devers" <Devers@discussions.microsoft.com> wrote in message
> > news:791882FB-3B39-4E62-8E9F-549D0697F76D@microsoft.com...
> > > Dan-
> > >
> > > 1) Make sure the Grid_Codes.RecordSource property is empty at design
time.
> > > 2) Always clear the RecordSource before you re-create "somecursor" and
> > then
> > > afterwards, re-bind the grid using your standard code.
> > >
> > > Hope that helps!
> > >
> > > "Dan Tallent" wrote:
> > >
> > > > I have a container class that contains a grid. The grid was setup
to
> > have
> > > > specific column names. I set the grid to point to a cursor during
> > runtime.
> > > > This allows me the ability to have multiple instances of the
container
> > using
> > > > different cursors. The container is loaded onto a form at runtime
as
> > the
> > > > user needs this interface. The code below is my standard way of
> > "binding"
> > > > the data to the grid.
> > > >
> > > > cTempFile1 = "somecursor"
> > > > this.Grid_Codes.recordsource = 1 && Alias
> > > > this.Grid_Codes.recordsource = cTempFile1
> > > > this.Grid_Codes.col_code.controlsource = cTempFile1 + ".cCode"
> > > > this.Grid_Codes.col_desc.controlsource = cTempFile1 + ".cDesc"
> > > >
> > > > The problem I am having is, sometimes (hard to repeat), I get errors
> > because
> > > > the code is referring to the col_code column. VFP errors out
stating
> > > > "Unknown member COL_CODE".
> > > > It turns out, that the grid has lost the names of the grid, and now
has
> > the
> > > > names Column1 and Column2 instead of col_code and col_desc.
> > > >
> > > > Has anyone else seen this problem, and does anyone have a
resolution?
> > > >
> > > > Thanks,
> > > > Dan Tallent
> > > >
> > > >
> > > >
> > > >
> >
> >
> >



Re: VFP 8: Grids (bug problem) by Dan

Dan
Mon Jun 27 06:01:14 CDT 2005

I appreciate the help,

thx,
Dan

"Jack Jackson" <jacknospam@pebbleridge.com> wrote in message
news:r9gob1l4da6np38kdlusnp4q40smvfu6a0@4ax.com...
> On Fri, 24 Jun 2005 08:42:51 -0400, "Dan Tallent"
> <dtallent@NOTEarthlink.net> wrote:
>
> >I have a container class that contains a grid. The grid was setup to
have
> >specific column names. I set the grid to point to a cursor during
runtime.
> >This allows me the ability to have multiple instances of the container
using
> >different cursors. The container is loaded onto a form at runtime as the
> >user needs this interface. The code below is my standard way of
"binding"
> >the data to the grid.
> >
> >cTempFile1 = "somecursor"
> >this.Grid_Codes.recordsource = 1 && Alias
> >this.Grid_Codes.recordsource = cTempFile1
> >this.Grid_Codes.col_code.controlsource = cTempFile1 + ".cCode"
> >this.Grid_Codes.col_desc.controlsource = cTempFile1 + ".cDesc"
> >
> >The problem I am having is, sometimes (hard to repeat), I get errors
because
> >the code is referring to the col_code column. VFP errors out stating
> >"Unknown member COL_CODE".
> >It turns out, that the grid has lost the names of the grid, and now has
the
> >names Column1 and Column2 instead of col_code and col_desc.
> >
> >Has anyone else seen this problem, and does anyone have a resolution?
>
> This is standard grid behavior.
>
> If you recreate the grid's record source, all of the columns are
> removed and replaced. To avoid this, set the grid's RecordSource to
> empty ('') before rebuilding the cursor, then set it back.
>