inserting new data into datagrid

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 31
Reputation: harcaype is an unknown quantity at this point 
Solved Threads: 0
harcaype harcaype is offline Offline
Light Poster

inserting new data into datagrid

 
0
  #1
Jul 7th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 48
Reputation: mzd12111 is an unknown quantity at this point 
Solved Threads: 0
mzd12111 mzd12111 is offline Offline
Light Poster

Re: inserting new data into datagrid

 
0
  #2
Jul 11th, 2008
i want to design a mailbox(in windows application mode) so i need to draw a table (in fact a matrix ) which the Columns are "Sender" and "Subject" and the rows are different mails received.
but i cant figure out how to draw a table on the screen , and bind it firstly and for test to some data which are i enter and finally to a database which is store the mails info.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC