Enumerate Grids

I have a form that has 10 separate fpSpreads/grids on it.  
Each grid will get filled in a class.
What I would like to do is enumerate each grid and be able to define it as the actual grid.
This is what I usually declare it as when I need to use an actual grid.
Private mfpGrd As FarPoint.Win.Spread.FpSpread
How can enumerate these grids and use it in my application?
Please provide example code, clicking on links crashes my IE.
Who is Participating?
CodeCruiserConnect With a Mentor Commented:
I love to help but i only get this opportunity when no one else if able to answer questions then i get the notification and come to the site. I currently have more than 100 question alerts sitting in my inbox. I would try my best to answer the question.
I am still unable to understand the problem actually. To reference to something, you obviously need a name. You may consider using collections or lists.
The question is not very clear. You have a Windows Forms app where you use a number of grids. You need to access each grid right?
SheritlwAuthor Commented:
I wanted to be able within code be able to use the intelliscence to know what the grid name is, but I also need to pass the grid to a class.
I have finished the form I was working on and just created some properties and had to hard code the names of the grids everywhere.
I am preparing another form, actually a usercontrol and would love to be able to have the names and grids easy to assess.
I created a question named "Copy Everything from TabPage1 to tabpage2" but the answer I got was for VB 6, not VB 2008 or VB.Net.
You have helped me before and have always provided great solutions.  If you want to work with me, I will be creating a lot of questions.
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

SheritlwAuthor Commented:
How would I go about creating a collection?
SheritlwAuthor Commented:
Well I read all  the articles and I understand a lot of it.  I used to use a lot  of  control collections  in VB 6 but need a sample that will create a collection of my fpSpread grids  in VB2008.
You need to create the grids yourself. Configure the grids and add them to the collection by using the add method.
SheritlwAuthor Commented:
Yes, I know.   I  have already created all  the grids and I know about the add method, I just need to know  what the  format  is for creating a collection that it knows each item  is a spread so I can use the properties etc. of  the fpSpread.
In enumeration, you can't define a control type, that's why I thought your idea for a collection would be great.
I  need to know how to define it.  but is a collection layed out like an enum???
I started with  this  declaration...

Private FGrd As FarPoint.Win.Spread.FpSpread.ControlCollection
Collect as fGrd  ???? how do I get started????
SheritlwAuthor Commented:
Well I finally found an example on  the net.  
Thank you for steering me towards collections... pretty easy in  .Net

The following is what I am using...

    Public FGrd As New Collection

    Private Sub frmRaces_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Private Sub AddToCollection()

        With FGrd


        End With
    End Sub
    Private Sub FormatHeaderCells()
        Dim sv As FarPoint.Win.Spread.SheetView
        Dim cnt As FarPoint.Win.Spread.FpSpread

        For Each cnt In FGrd

            cnt.ActiveSheet.ColumnHeader.Visible = True

            cnt.ActiveSheet.VisualStyles = FarPoint.Win.VisualStyles.Off
            cnt.ActiveSheet.ColumnHeader.RowCount = 1
            sv = cnt.ActiveSheet
            sv.AddColumnHeaderSpanCell(0, 1, 1, 2)
            sv.Columns(1, 2).Label = ReturnLabel(cnt.Name)
            sv.ColumnHeader.Cells(0, 1, 0, 2).BackColor = ReturnColor(cnt.Name)
            If InStr(cnt.Name, "fpGrdFront") Or InStr(cnt.Name, "fpGrdRear") Then
                sv.ColumnHeader.Cells(0, 1, 0, 2).Font = New Font(cnt.Font.Name, 6.5, FontStyle.Bold)
                sv.ColumnHeader.Cells(0, 1, 0, 2).Font = New Font(cnt.Font.Name, 8, FontStyle.Bold)
            End If

        Next cnt

    End Sub
Glad that my idea was helpful to you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.