DBGrid Freeze one column

I need to freeze the first column when scrolling horizontally.  How is this done?
KathyBrowningAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

stew1Commented:
Kathy,
      Check the property pages for split. Play with this property and it should work.

Stew
0
stew1Commented:
here is some info from Microsoft...
The DataGrid supports Excel-like splits that divide the grid into vertical panes to provide users with different views of a database. Each split is represented by a Split object and contains a group of adjacent columns that scroll as a unit. When a DataGrid object is created, it contains one Split object by default.

You can use splits to present your data in multiple vertical panes. The data panes (or splits) can display data, scroll (vertically) together or independently of each other, and display the same or different columns. You can also use splits to fix one or more columns from scrolling. Unlike other grid products, the fixed columns do not have to be at the left edge of the grid, but can be at the right edge or anywhere in the middle. You can even have multiple groups of fixed columns within a grid.

0
KathyBrowningAuthor Commented:
Thanks Stew, I have played with this and have been unsuccessful.  The Column that I am trying to freeze is Column 0 (or the first column).  Perhaps you can be a bit more specific.

Thanks,
Kathy
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

stew1Commented:
Kathy,
 Here is some code from MSDN. This should help to set up your grid.

Private Sub Form_Load()    ' Before modifying the grid's properties, make sure
    ' the grid is initialized by refreshing the Data    ' control.
    Adodc1.Refresh    ' Create an additional splits:
    DataGrid1.Splits.Add 0 ' Create an additional split
    ' Hide all columns in the leftmost split,
    ' Splits(0), except for columns 0 and 1    Dim Cols As Columns, C As Column
    Set Cols = DataGrid1.Splits(0).Columns    For Each C In Cols
        C.Visible = False    Next C    Cols(0).Visible = True
    Cols(1).Visible = True    ' Configure Splits(0) to display exactly two
    ' columns, and disable resizing    With DataGrid1.Splits(0)        .Size = 2
        .AllowSizing = False    End With
    ' Usually, if you fix columns 0 and 1 from
    ' scrolling in a split, you will want to make them
    ' invisible in other splits:    Set Cols = DataGrid1.Splits(1).Columns
    Cols(0).Visible = False    Cols(1).Visible = False
    ' Turn off the record selectors in Split 1:
    DataGrid1.Splits(1).RecordSelectors = FalseEnd Sub
0
jgvCommented:
Here's how to do it at design time:

Right click the grid-->"Retrieve Fields"
Right again-->"Edit"
Right again-->"Split"
Right again-->"Properties"-->"Layout" (tab)

- select "split0" from the 'split' dropdown...this is the left split.
- select the column you want to hide in this split from the 'column' dropdown. Uncheck the 'Visible' check box. Continue doing this for all the columns you do not want seen.
- select "split1" from the 'split' dropdown...this is the right split.
- same procedure as above
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jgvCommented:
Also, to size the left split so that it is the width of the displayed column:

Right click grid->properties ->splits (tab)

Make sure 'split0' is selected. In the 'SizeMode' dropdown select "2-Number of Columns"
0
KathyBrowningAuthor Commented:
Stew,

I don't want to step on any toes here... And appreaciate your help... but I also have access to the help files.  The comment that jgv sent is more what I was looking for.  

In the future, please post as comments, that way I can decide which 'comment' I decide to use as the appropriate answer.  If two experts have a way of doing something, I accept the comment that I was able to use as the answer.  In this case, it is jgv's.

Sincerely,
Kathy
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.