|
-
Oct 4th, 2002, 03:22 PM
#1
Thread Starter
New Member
Datagrid Column into an array
How do i store a datagrid column values into an array?
-
Oct 5th, 2002, 09:08 PM
#2
Hyperactive Member
Try this:-
dim arrRow() as object
arrRow = dataset.tables("table").rows(rowindex).itemarray
I haven't tried it so I don't know if it will work.
-
Oct 6th, 2002, 01:40 AM
#3
Fanatic Member
I don't think so, I'm fairly sure that would get all the fields in one datarow (ItemArray is another way of referring to fields in a datarow, just in the form of an Array instead of .Item("Name")).
I don't think you want to do this directly from the datagrid, as the datagrid is just a mouthpiece for a datasource (unless of course you're typing in rows at runtime) - you may want to query the datasource and then work with the data it contains. May I ask why you want to turn the contents into an array? You may not really need to, you can for example:
Dim iCount as Integer
For iCount = 0 to (dsData.Tables("Table").Rows.Count - 1)
DoSomeFunction(dsData.Tables("Table").Rows(iCount).Items("Column"))
Next
-
Oct 6th, 2002, 08:32 AM
#4
Hyperactive Member
Originally posted by Slow_Learner
I don't think so, I'm fairly sure that would get all the fields in one datarow (ItemArray is another way of referring to fields in a datarow, just in the form of an Array instead of .Item("Name")).
Lol this is exactly what I thought he wanted. Oh well must not be understanding people well anymore.
-
Oct 7th, 2002, 07:45 AM
#5
Thread Starter
New Member
Thanks for the replies.
I want to use an array because, i have two datagrids and need to pull out contents from a column of the first datagrid and add it to a column in the second datagrid (If those entries are not already there).
-
Oct 7th, 2002, 08:56 AM
#6
Fanatic Member
What you want to do sounds very like the DataSet.Merge method?
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemDataDataSetClassMergeTopic2.htm
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
|