Dynamically adding row to datagrid

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2009
Posts: 12
Reputation: farooq82 is an unknown quantity at this point 
Solved Threads: 0
farooq82 farooq82 is offline Offline
Newbie Poster

Dynamically adding row to datagrid

 
0
  #1
Feb 8th, 2009
Is anyone have idea of how we add new row in datagrid I want to add DR and CR Column in datagrid view DataGrid View have 4 column Sr#, Discription, DR, CR

  1. Dim DR As Decimal
  2. Dim CR As Decimal
  3.  
  4. DR = DataGridViewCashBook.Rows(index).Cells(4).Value.ToString()
  5. CR = DataGridViewCashBook.Rows(index).Cells(5).Value.ToString()
  6.  
  7. DataGridViewBankStatment.Rows.Add()
Last edited by farooq82; Feb 8th, 2009 at 5:07 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Dynamically adding row to datagrid

 
0
  #2
Feb 8th, 2009
I think you should add the row\column to the DataTable(The Data Source of the Grid) then bind the Grid again.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 63
Reputation: 4advanced is an unknown quantity at this point 
Solved Threads: 10
4advanced 4advanced is offline Offline
Junior Poster in Training

Re: Dynamically adding row to datagrid

 
0
  #3
Feb 9th, 2009
  1. Dim newRow as DataRow = yourDatagrid.newrow()
  2.  
  3. newRow.Item(0) = "yourText"
  4. etc. etc. etc.
  5.  
  6. yourDatagrid.rows.add(newRow)
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC