Solved

Loop through a selection set in a grid, it is a control that I bought called Flexcell grid

Posted on 2010-08-23
9
382 Views
Last Modified: 2013-12-26
This should be pretty easy but I don't have a handle on the exact selection set using a Flexcell grid. This is not the ms grid since it did not have the flexibility I needed, but it seems very similar.
I need to know the starting and ending Rows/Cols in the grid that have been selected so I can process that specific area. if anyone knows how I can do this with right click functionality that would be great. I just need to go cell by cell that has been selected.
Thanks
Div
0
Comment
Question by:dsulkar
  • 6
  • 3
9 Comments
 
LVL 17

Accepted Solution

by:
Zhaolai earned 500 total points
ID: 33507870
Assume that your flexcell control is named Grid1. Here is the code:

Dim i As Integer

Dim j As Integer

Dim oSelection As Selection

Set oSelection = Grid1.Selection



For i = oSelection.FirstRow To oSelection.LastRow

    For j = oSelection.FirstCol To oSelection.LastCol

        MsgBox Grid1.Cell(i, j).Text

    Next

Next

Open in new window

0
 
LVL 6

Author Comment

by:dsulkar
ID: 33510278
Here is what I get
And this has been my problem, I would have hoped that this info was readily available.

oSelection.FirstRow method or data member not found.

it is acting like you can only work on the selection and not one cell at a time.

I have a work around but It is ugly

Please remember this is an aftermarket grid called Flexcell grid version 5.8.4

Thanks
0
 
LVL 17

Expert Comment

by:Zhaolai
ID: 33510731
Hmmm... I downloaded the trial version (5.8.4) of the control.
Open Object Browser (Press F2 in VB6 IDE). Select FlexCell. Do you see the same thing as the attached screenshot below (FirstCol, FirstRow, LastCol, LastRow)?


Screenshot.PNG
0
 
LVL 6

Author Comment

by:dsulkar
ID: 33511280
I am using vba and access 2000, The object browser shows exactly what you sent. Still trying to figure out why it won't work
Thanks
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 6

Author Comment

by:dsulkar
ID: 33511374
OK I changed it to this and it worked fine, any ideas why the dim of the selection did not work?

With GridMain.Selection
For i = .FirstRow To .LastRow 'FirstRow To oSelection.LastRow
    For j = .FirstCol To .LastCol
        MsgBox GridMain.Cell(i, j).Text
    Next
Next
End With

Either way, thats all I was looking for. Thanks for reminding me to look at the object browser, I was just relying on the help file.
0
 
LVL 17

Expert Comment

by:Zhaolai
ID: 33511394
Change
    Dim oSelection As Selection
to
    Dim oSelection As FlexCell.Selection

I suspect that Selection may have multiple definitions.


0
 
LVL 6

Author Comment

by:dsulkar
ID: 33511422
Exactly right
Thanks a bunch, my brain was just not wanting to work. I appreciate the help.
Div
0
 
LVL 6

Author Closing Comment

by:dsulkar
ID: 33511437
This is why I love this site, get quick answers in a pinch
0
 
LVL 6

Author Comment

by:dsulkar
ID: 33511554
Hey there why did it only give the solution an 8.8 when it should have been 10?
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now