Hi ,

Anybody please help me in this ..it is an urgent for me.

Actually i have a DataGridview in my window which should be with one fixed row and 2 fixed columns.

Fixedrow is done in Datagridview with the headercolumn property. Now i need to add 2 columns as fixed..

I tried with cell.frozen property, then the column is frozen, but still the tab control goes into this cells.and also it is not appearing same as column header.

Is there a way to make this 2 columns as rowheader?

In VB6 Flexgrid we have the option Fixedcols=2 ....is there any equivalent in DataGrideview windows C#?

Anyone please help me, asap...

Thanks in advance.

- Rami

Hi ,

Anybody please help me in this ..it is an urgent for me.

Actually i have a DataGridview in my window which should be with one fixed row and 2 fixed columns.

Fixedrow is done in Datagridview with the headercolumn property. Now i need to add 2 columns as fixed..

I tried with cell.frozen property, then the column is frozen, but still the tab control goes into this cells.and also it is not appearing same as column header.

Is there a way to make this 2 columns as rowheader?

In VB6 Flexgrid we have the option Fixedcols=2 ....is there any equivalent in DataGrideview windows C#?

Anyone please help me, asap...

Thanks in advance.

- Rami

Hi wy not try this

If u need fixed rows in the datagrid, u can declare a datatable
eg:

System.Data.DataTable temp = new System.Data.DataTable();
            DataColumn col;
            col = new DataColumn("Source");
            temp.Columns.Add(col);
            col = new DataColumn("Destination");
            temp.Columns.Add(col);
temp.AcceptChanges();

Later import the datatable in datagrid (assuming that u have created a form which have datagridview control in it)

Details frm1 = new Details(oDataTable);

then populating in the datagridview using

public partial class Details : Form
    {
        DataTable pDataTable = new DataTable();
        public Details(DataTable oDataTable)
        {
            InitializeComponent();
            if (pDataTable != null)
            {
                pDataTable = oDataTable;
            }
        }

        private void Details_Load(object sender, EventArgs e)
        {
           frm1.DataSource = pDataTable;  
        }
    }

Later using following code to freeze additional columns

this.dataGridView1.Columns["Source"].Frozen = true;

hope it helps a lill:icon_smile:

Hi Ved_Theone,

Thanks for your reply,

Actually i tried Frozen early
(dataGridView1.Columns[0].Frozen = true; ), but the column is not behaving as similar as the column header, for example...here
1, the frozen column cell can be selected individually, the data inside the cell (i.e control enters into the frozen cell)....
2,The colour and appearence is not same as in column headers....etc...

For me i need the first 2 columns of the datagridview to be fixed and act / look similar to column header for each row in the grid.


can u help me on this......

Thanks in advance.,

-Rami.

Member Avatar for Jaypeagi

I realise this is out of date, but just in case anyone else comes across this thread like I did: frozen columns (like you get in Excel) can be achieved by using the .Frozen property.
However, if you wanted these columns to have a similar appearance to the column header cells, you are looking for RowHeaders, accessed by dataGridView1.Rows.HeaderCell.Value

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.