?
Solved

Enumerate Grids

Posted on 2009-04-16
10
Medium Priority
?
491 Views
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.
Thanks
0
Comment
Question by:Sheritlw
  • 5
  • 5
10 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
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?
0
 

Author Comment

by:Sheritlw
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.
Thanks
Sheri
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 1500 total points
ID: 24177177
Sheri,
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.
0
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

by:Sheritlw
ID: 24180848
How would I go about creating a collection?
Thanks
0
 

Author Comment

by:Sheritlw
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.
Thanks
0
 
LVL 83

Expert Comment

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

Author Comment

by:Sheritlw
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????
Thanks
0
 

Author Comment

by:Sheritlw
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
        AddToCollection()
        FormatHeaderCells()

    End Sub

    Private Sub AddToCollection()

        With FGrd

            .Add(Me.fpGrdEngines5)
            .Add(Me.fpGrdFront5)
            .Add(Me.fpGrdGearing5)
            .Add(Me.fpGrdLFront5)
            .Add(Me.fpGrdLRear5)
            .Add(Me.fpGrdRear5)
            .Add(Me.fpGrdRFront5)
            .Add(Me.fpGrdRRear5)
            .Add(Me.fpGrdWings5)

        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)
            Else
                sv.ColumnHeader.Cells(0, 1, 0, 2).Font = New Font(cnt.Font.Name, 8, FontStyle.Bold)
            End If

        Next cnt


    End Sub
0
 
LVL 83

Expert Comment

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

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