locked
dataGridViewCell and Editing RRS feed

  • Question

  • Hi guys

    How can i programmatically turn a dataGridViewCell to be in edit mode?

     

    thank you in advance

    Sorsh

     

    Sunday, October 14, 2007 12:49 PM

Answers

  •  

    Hi Sorsh,

    We can call the DataGridView.BeginEdit to put the current cell in edit mode. Try the following code:

    Code Block

                this.dataGridView1.CurrentCell = this.dataGridView1[0, 3];//change to the cell you want

                this.dataGridView1.BeginEdit(true);

     

    Hope this helps.
    Best regards.
    Rong-Chun Zhang

    Tuesday, October 16, 2007 2:16 AM

All replies

  •  

    dgMyGridView.EditIndex = iRowToEdit;

     

    Something like that - cant remember exactly what the property is called.

     

    Hope that helps

     

    Ross

    Sunday, October 14, 2007 2:14 PM
  • Thanks you for the answer but there is no such property.

    The closetest thing is the editing control and i already tried to used it.

    The problem is since none of the cell is in edit mode , the edit control is null.

    I tried to initialize using the method InitializeEditingControl (using msdn c# examples) it but i failed.

     

    If you have more ideas about the subject i whould be happy to hear

    Sorsh

    Monday, October 15, 2007 7:44 AM
  • Sorry, just realised this was a windows forms forum, not asp.net - I have no idea! sorry I cant help you.

     

    Monday, October 15, 2007 11:00 PM
  •  

    Hi Sorsh,

    We can call the DataGridView.BeginEdit to put the current cell in edit mode. Try the following code:

    Code Block

                this.dataGridView1.CurrentCell = this.dataGridView1[0, 3];//change to the cell you want

                this.dataGridView1.BeginEdit(true);

     

    Hope this helps.
    Best regards.
    Rong-Chun Zhang

    Tuesday, October 16, 2007 2:16 AM
  •  

    Thanks thats realy helped ^_^
    Tuesday, October 16, 2007 9:56 AM