user997112
user997112

Reputation: 30615

DataGridView, always keep first column visible whilst horizontally-scrolling?

I have a DataGridView with 10 columns, lets say columns 7, 8, 9 and 10 are hidden when column 0 is visible as the form is a little narrow. I can scroll horizontally to view column 10, but this hides column0.

How can I keep column0 visible at all times whilst scrolling horizontally? So the scrollbar wouldn't actually extend to column0.

I am using Visual Studio 2013 (so I think thats .net 5?)

Upvotes: 3

Views: 3508

Answers (1)

LarsTech
LarsTech

Reputation: 81610

Try using the Frozen property:

Gets or sets a value indicating whether a column will move when a user scrolls the DataGridView control horizontally.

dataGridView1.Columns[0].Frozen = true;

Upvotes: 7

Related Questions