Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


msflexgrid, need to determine if column is visible within users viewing area

Posted on 2001-08-29
Medium Priority
Last Modified: 2012-06-27
I have a grid with 13 columns. The last 3 columns aren't visible to the user because of the size of the grid. I need to determine this some how. When I scroll over I want to know when they become visible (to the user).

I tried .ColIsVisible - seemed like a piece of cake. NOT, this returns wether the column is hidden or not. The columns aren't hidden, they just aren't in the viewable area.

I tried comparing the grids.width to the columns.CellLeft, this didn't work. It returned what looks like a bad value when the column is outside the viewable area.

So I need some way to tell if a column is within the users viewable area or it's outside.

Question by:RPWard
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 44

Expert Comment

ID: 6437158
am I missing something, or did you not provide the answer yourself:

"I tried comparing the grids.width to the columns.CellLeft, this didn't work. It returned what looks
like a bad value when the column is outside the viewable area."  

Can't you test for that "what looks
like a bad value", and use that to indicate that the column is outside the viewable area?

Expert Comment

ID: 6437239

I'm curious ... *why* do you want to know when the column is scrolled into the viewable area ... what is your program going to do at that time?

Accepted Solution

kuppachi earned 600 total points
ID: 6437461
colisvisible(colindex) returns true or false depending on whether the column is in the visible area or not. And not whether it is hidden or not.

try this code before the last column is visible and after u scroll to the last column.

Private Sub Command1_Click()
MsgBox MSFlexGrid1.ColIsVisible(12)
End Sub
Independent Software Vendors: 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!


Expert Comment

ID: 6437503
The CollsVisible do return if or not the column is in the viewable area...... maybe you are ont using the right index number?
LVL 27

Expert Comment

ID: 6437520
Yep, I think kuppachi is right.
I checked it with this code

Private Sub MSFlexGrid1_Scroll()
 If MSFlexGrid1.ColIsVisible(12) Then
    MsgBox "here is the first view of cell Scroll 12"
 End If
End Sub

Author Comment

ID: 6437671
Bad Value - something less than the grid.width. Looks like columns that are outside the viewable area are just behind the last column as fas as .CellLeft is concerned.

Author Comment

ID: 6437756
Thanks, you were right. I was looping through all the columns and part of the loop was changing the current col and row (which I reset at the end of the loop). Problem was - changing the current col and row also changed (I guess) the viewable area, so the ColIsVisible as true. But not when the current col and row were reset.

Your answer helped me find the problem, thanks again.

Expert Comment

ID: 6437825

I'm still curious.  What special thing are you wanting to do when a certain column comes into view?

-Dennis Borg

Author Comment

ID: 6440662
Dennis, I am about to put up another question. Trying to get the headers to merge cells, but still have select highlight on.

What I was playing around with was placing a label (actually a picture box with a label in it) on top of the column header cells I wish to merge. Wish they had a "center across cells" option when building the fixed headers.

Got it to work, but don't like it much. Have to put all kinds of code on labels when clicked on to act like clicking on column headers.

Thanks for being curious  :)

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

636 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