query

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

Join Date: Dec 2008
Posts: 39
Reputation: arunasingh is an unknown quantity at this point 
Solved Threads: 0
arunasingh arunasingh is offline Offline
Light Poster

query

 
0
  #1
Apr 28th, 2009
i am developing windows application project

i want that in a datagridview if there is data in the first row ,then i want that if i enter then that above row is copied as next row below the first row.so how i do code in enter of any cell in data gridview and generate next row
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: query

 
0
  #2
Apr 28th, 2009
Try this

  1. Private Sub DataGridView1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyUp
  2. If Keys.Enter Then
  3. Dim _Dt As DataTable = Me.DataGridView1.DataSource
  4. If _Dt IsNot Nothing Then
  5. Dim _NewRow As System.Data.DataRow = _Dt.NewRow
  6. _Dt.Rows.Add(_NewRow)
  7. Me.DataGridView1.DataSource = _Dt
  8.  
  9. _NewRow = Nothing
  10. _Dt.Dispose()
  11. _Dt = Nothing
  12.  
  13. End If
  14.  
  15. End If
  16. End Sub
Last edited by 4advanced; Apr 28th, 2009 at 7:16 am.
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