CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Posts
    66

    Editing cells in datagridview

    Hi all!

    I would like to ask you something related a problem which occurs in my app.

    There is a datagrid view, which I add and delete some rows.

    All the rows must be "ReadOnly" rows, except the first one. The user of application must be able to edit the first row of the datagrid using the keyboard in order to type the data.

    I try this code in order to have this behavior:
    Code:
                this.m_snapshotDatagrid.Rows.Clear();
    
                this.m_snapshotDatagrid.Rows.Add();
                this.m_snapshotDatagrid.Rows[0].ReadOnly = false;
    But, when I try to edit the row, I am not able to edit any cell of the first line of the datagrid.

    Does someone could help me to solve this problem?

    Thank you in advance!
    Gustavo

  2. #2
    Join Date
    Dec 2005
    Location
    Waterloo ON
    Posts
    545

    Re: Editing cells in datagridview

    Quote Originally Posted by gborges View Post
    Hi all!

    I would like to ask you something related a problem which occurs in my app.

    There is a datagrid view, which I add and delete some rows.

    All the rows must be "ReadOnly" rows, except the first one. The user of application must be able to edit the first row of the datagrid using the keyboard in order to type the data.

    I try this code in order to have this behavior:
    Code:
                this.m_snapshotDatagrid.Rows.Clear();
    
                this.m_snapshotDatagrid.Rows.Add();
                this.m_snapshotDatagrid.Rows[0].ReadOnly = false;
    But, when I try to edit the row, I am not able to edit any cell of the first line of the datagrid.

    Does someone could help me to solve this problem?

    Thank you in advance!
    Gustavo
    First of all, make sure if DataGridView.ReadOnly = false. Then check all columns you want to eidt are readonly or not. If the column is readonly, you can't edit the related cell even the row is not readonly.
    The difficulty is that you have no idea how difficult it is.

    .Net 3.5/VS 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured