I've been figuring out how to insert data directly on the datagrid. It's like when I click on a row, I can edit it or add another just by clicking on that specific row and then update it. Can someone help me do this? I've search the net and what I got in the codeproject website was not complementing with my VS 2005, so I need an alternative.
Here's the code from codeproject:
int this.iRowIndex = 0;
private void fnInsertNew()
{
//keep in mind the previous clicked row to unselect
int iPrevRowindex=this.iRowIndex;
MessageBox.Show("Enter the new record at the end of the DataGrid and click 'Save/Update'-button", "Stop");
this.btInsertnew.Enabled=false;
//get how many records in the table
this.iRowIndex=this.dataSet11.Tables["MyContactsTable"].Rows.Count;
//select the last row
this.dataGrid1.Select(this.iRowIndex);
//unselect the previous row
this.dataGrid1.UnSelect(iPrevRowindex);
}
This doesn't seem to work for me for the fact that "Unselect()" method does not exist in my intellisense. Also when I use ".Select(iRowIndex)" it gets an error that it says it cannot have any arguments or the Select method has 1 argument. Can anyone help me with this?