|
-
Apr 20th, 2005, 09:42 AM
#1
Thread Starter
Junior Member
Datagrid:Current DataRow Copy to NextRow(SOLVED)
Hi people!I have gotten along in my PDA software development nicely with some help from others.I need some assistance once again.Right now,i have a row of data(in a datagrid) that i wish to copy to a new row right below it.How do i go about it?Pls help if u can.I would appreciate it alot!
Last edited by Irkiere; Apr 25th, 2005 at 08:08 PM.
-
Apr 20th, 2005, 10:05 PM
#2
Thread Starter
Junior Member
Re: Datagrid:Current DataRow Copy to NextRow
Pls help if u can,i have been trawling through the net and can't find any suitable answers!
-
Apr 21st, 2005, 03:31 AM
#3
Fanatic Member
Re: Datagrid:Current DataRow Copy to NextRow:PLS Help!
firstly is the datagrid based on a database table or are you just adding data to it using datarow method?
secondly if it is based on table do you want to insert the data to table or just add it to the datagrid
Barry
Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
.NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0
SQL Server 2005/2000/SQL Server CE 2.0
If you like, rate this post
Compact Framework for Beginners
-
Apr 21st, 2005, 09:32 AM
#4
Thread Starter
Junior Member
Re: Datagrid:Current DataRow Copy to NextRow:PLS Help!
Thanks for bothering once more strider.Yah,my datagrid is bound to a dataset.Anyway,i have gotten the solution from a friend of mine(Dennis Oh from Singapore).I'm at home now and will post the solution tomorrow morning to share with you guys just in case someone else needs it.Paying it forward !!
-
Apr 21st, 2005, 10:30 PM
#5
Thread Starter
Junior Member
Here's the solution !
Private Sub DuplicateRow(ByRef dt As DataTable, ByRef dg As DataGrid, ByVal iIndex As Integer)
'iIndex is the row to duplicate
Dim dr As DataRow = dt.NewRow
Dim iCol As Integer
For iCol = 0 To 32 'dt.Columns.Count
With dt.Rows(iIndex)
dr.Item(iCol) = .Item(iCol)
End With
Next
dt.Rows.InsertAt(dr, iIndex)
dg.DataSource = dt
End Sub
Private Sub MenuNewUnit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuNewUnit.Click
Call DuplicateRow(ds.Tables("MechanismLifeTest"), DataGrid1, ds.Tables("MechanismLifeTest").Rows.Count - 1)
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|