Enumerate Grids

Posted on 2009-04-16
Medium Priority
Last Modified: 2012-08-14
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.
Question by:Sheritlw
  • 5
  • 5
LVL 83

Expert Comment

ID: 24177120
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?

Author Comment

ID: 24177161
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.
LVL 83

Accepted Solution

CodeCruiser earned 1500 total points
ID: 24177177
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.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 24180848
How would I go about creating a collection?

Author Comment

ID: 24180912
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.
LVL 83

Expert Comment

ID: 24180930
You need to create the grids yourself. Configure the grids and add them to the collection by using the add method.

Author Comment

ID: 24181483
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????

Author Comment

ID: 24181699
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
LVL 83

Expert Comment

ID: 24182689
Glad that my idea was helpful to you.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question