DBGrid Freeze one column

I need to freeze the first column when scrolling horizontally.  How is this done?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

jgvConnect With a Mentor Commented:
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
      Check the property pages for split. Play with this property and it should work.

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.

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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.

 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
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"
KathyBrowningAuthor Commented:

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.

All Courses

From novice to tech pro — start learning today.