Column freeze example

Oct 15, 2008 at 7:05 PM
Hi

I'm looking for a  simple example on how to freeze columns.

Here is what I'm trying to accomplish. 

1) I select a cell on a datagrid.
 
2) I find out the column number of the selected cell 

Dim

 

col = DataGrid1.Columns.IndexOf(DataGrid1.CurrentCell.Column)

3) Now I want to freeze this column. I tried to do this
with  

 

DataGrid1.Columns(col).IsFrozen =

True

but it dos not work. It gives me the following error:

Error 1 'Set' accessor of property 'IsFrozen' is not accessible. 

What am I doing wrong? A simple example would help.
Thanks


Marius

Coordinator
Oct 15, 2008 at 7:48 PM
IsFrozen is a read-only property so you cannot set a column to be frozen in that manner.  To set frozen columns you have to go with the DataGrid.FrozenColumnCount API.