Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Borislav Borissov
  Where is Borislav Borissov?
 Sofia
 Bulgaria
 Borislav Borissov
 To: Ovette Abejuela
  Where is Ovette Abejuela?
 Cagayan de Oro City
 Philippines
 Ovette Abejuela
 Tags
Subject: RE: Grid: Count Number of Fileds
Thread ID: 143139 Message ID: 143140 # Views: 2 # Ratings: 1
Version: Visual FoxPro 9 Category: Grids
Date: Saturday, August 25, 2007 9:13:50 AM         
   


> Hi,
>
> I'm just starting to explore grids and hopefully uncover every possible things I can do with it and along the way this is the first problem that I have:
>
> - I have a grid in a form which takes data from a local view
> - this grid's number of columns is dynamic (default Grid1.ColumnCount = -1)
> which will accommodate the number of fields of its record source
> - now i actually need to traverse through all the columns but since its
> dynamically created i presumably do not know as to how many columns/fields
> this particular field have.
> - bottom line, Id like to know if there is a way to find out as to how
> many fields/columns are there present in that particular grid.
>

> I really do appreciate your help, thank you.
>
> -zbatev

Ovette,
You could check Grid1.ColumnCount property. It is set to right value after the grid gets its recordsource.
Something like:
thisform.Grid1.ColumnCount = -1
thisform.Grid1.RecordSource = [Blah Blah]
WAIT WINDOW thisform.Grid1.ColumnCount


If you want to traverse through all the columns you could use FOR EACH:
thisform.Grid1.ColumnCount = -1
thisform.Grid1.RecordSource = [Blah Blah]
FOR EACH oCol IN thisform.Grid1.Columns
   WAIT WINDOW oCol.ControlSource
NEXT



-----------------
Borislav Borissov

Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.

ENTIRE THREAD

Grid: Count Number of Fileds Posted by Ovette Abejuela @ 8/25/2007 9:08:17 AM
RE: Grid: Count Number of Fileds Posted by Borislav Borissov @ 8/25/2007 9:13:50 AM
RE: Grid: Count Number of Fileds Posted by Ovette Abejuela @ 8/25/2007 9:39:34 AM
RE: Grid: Count Number of Fileds Posted by Ken Murphy @ 8/25/2007 2:25:06 PM
RE: Grid: Count Number of Fileds Posted by Ovette Abejuela @ 8/25/2007 3:58:42 PM
RE: Grid: Count Number of Fileds Posted by Cetin Basoz @ 8/25/2007 10:53:41 AM