Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Partial Horizontal Scrolling of MSFlexGrid

Posted on 1998-09-23
3
Medium Priority
?
956 Views
Last Modified: 2012-08-13
Is it possible to do horizontal scrolling on only a portion of the columns of a MSFlexgrid?

Suppose I create a MSFlexgrid which is 30 columns wide.  I make it so that only 10 columns can be displayed on the screen and the remainder can be scrolled right and left with a horizontal scroll bar.  So far so good.

Is there any way that I can control the scroll so that columns 0 to 4 stay in a fixed horizontal position and columns 5 to 29 are the only ones affected by the scroll bar - sort of like a Lotus spreadsheet with the first 5 columns fixed?

PLEASE NOTE: that I do not want to declare columns 0 to 4 as "fixed" columns in the usual sense.  I want to reserve this for column 0 only (with the usual light grey backgound color for the purpose of highlighting Row Titles etc.).

I still want to have columns 1 to 4 behave as normal FlexGrid columns where cells can be selected and highlighted by dragging focus rectangle with the mouse in the conventional manner.  Its just that I want to "FREEZE" them from scrolling horizontally.

The only solution I can think of is to have TWO FlexGrids side by side.  The first one will be 5 columns wide with NO scroll bar.  And the second one will be 25 columns wide WITH a scroll bar.  Then I must figure out how to link them together so that they are both controlled by the same VERTICAL scroll bar and they appear to the user to be just one FlexGrid.

dougr
0
Comment
Question by:dougr
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
schild earned 150 total points
ID: 1436383
Hello Dougr

First the bad news. No you can't simply scroll part of the cells.
Your idea for putting a control by control is the only idea I know.
As for the scrolling synchronize, here is the needed code:
(I assumed that you put the scrollbar in the second control)

Private Sub MSFlexGrid2_Scroll()

    MSFlexGrid1.TopRow = MSFlexGrid2.TopRow
   
End Sub

Good luck
Schild


0
 

Author Comment

by:dougr
ID: 1436384
To: schild  

Thanks for the bad news and the code.

Actually either of the two FlexGrids can be scrolled (by vertical Scroll Bars, PgUp/Dn, ArrowUp/Dn keys etc.) so I put similar code in the Scroll event of both FlexGrids.

It seems to work ok, but it makes revisions, inserts, deletes and updates quite a bit more complex as I must write code for both grids.  Oh well, C'est la vie!

dougr
0
 

Author Comment

by:dougr
ID: 1436385
To: schild  

Thanks for the bad news and the code.

Actually either of the two FlexGrids can be scrolled (by vertical Scroll Bars, PgUp/Dn, ArrowUp/Dn keys etc.) so I put similar code in the Scroll event of both FlexGrids.

It seems to work ok, but it makes revisions, inserts, deletes and updates quite a bit more complex as I must write code for both grids.  Oh well, C'est la vie!

dougr
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

926 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