Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving values from multiple rows selected in a datagrid

Status
Not open for further replies.

Takis

Instructor
Oct 12, 2001
57
GR
I managed to retrieve only one value of the first of the selected rows of a datagrid and copy it to the clipboard using the following line:

Clipboard.SetDataObject(DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 15), False)

but how can i retrieve values from all the rows selected at once?

Thanks
 
Once you have the rows selected just use one line of code
Code:
SendKeys.Send("^c")
It will simulate pressing Control-C and thus copy whatever's selected.
 
the sendkeys.send does not seem appropriate to me!
As i understand i must use the
Clipboard.SetDataObject(DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 15), False)
in combination with an array that will keep all of the values that i want to copy

 
i don't know much about the clipboard. i guess the regular clipboard will only contain one object at a time. however the Microsoft Office clipboard can contain mulitple objects.

So maybe consider using the Office clipboard.

or concatenate the rows into a string (or some datatype) and copy that to the system clipboard.

just a suggestion.

-Jer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top