Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scroll MSFLEXGrid to desired column

Status
Not open for further replies.

JBG

Programmer
Oct 22, 2001
99
US
I have a VB6 app. that utilizes an MSFLexgrid control. The first 2 columns are fixed, as is the first row which contains the column headings.

This is a sales forecasting app. There are a total of 73 columns, which include 6 columns for each month of the year (i.e., prior year forecasted amt., actual amt., percentage difference, then the current year forecast and actual amounts, and then another calculated column for the difference of those two values)

So, for example, columns 44-50 could have column names:

AugPYF-AugPYA-%diff-AugCYF-AugCYA-%diff

Right now, if the user has the flexgrid control scrolled all the way to the left, which would show the January columns(JanPYF, JanPYA, etc.), I would like to be able to have them choose a month, say, August, from a dropdown, click a button, and have the MSFlexgrid "scroll" to the right until the month-chosen-column is at the very left(that is, the flexgrid scrolls to the right until the columns for "Aug" are visible).

The idea is to elimnate the need for the user to have to manually scroll through dozens of columns to find the particular column they need to view.

I tried using a setfocus routine, which does set the focus, but does not actually move the grid to the desired column:

EXAMPLE:
Code:
Private Sub Command2_Click()
      With MSFlexGrid1
         .Col = 0 
         .Row = 2 
         .ColSel = 1 
         .RowSel = 4 
         .SetFocus
      End With
End Sub

So, is it poossible to programmitcally scroll the MSFlexgrid to the desired column?

If so, anyone have some sample code?

Sorry for the long-winded post and much obliged in advance for any help. I am stumped.

JBG


 
Doh!!!!!

.LeftCol...

The sound you hear in the background is me kicking myself.

JBG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top