Discussion Locked

VB 6.0 Cut, Copy, Paste, Question

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am using MSFlexGrid to show data that is being brought in by the serial port.
i would like to copy and paste within MSFlexGrid . At the moment i can copy one cell and paste into one cell. i would like to be able to copy a multiple of cells, andpaste them in the flexgrid.
i tried using
Clipboard.clear
Clipboard.settext screen.activecontrol.seltext

and then for paste
screden.activecontrol.seltext=
clipboard.gettext()
this does not work
i am instead using
clipboard.clear
clipboard.settext MSFlexGrid.text
for paste
if len(clipboard.gettext) then msflexgrid.text = clipboard.gettext
this allows me to do only one cell of the grid.
How would i do multiple?

5 replies

by rrv

it is better you use MSHFlexgrid first.

then it requires atleast Visual studio service pack 3 and above for the below logic to work.

-logic-

1) Select the region in the mshflexgrid using rowsel,colsel properties.
2) Use mshFlexgrid's clip property to copy the selected region.

example

Grid.row=0
Grid.col=0
Grid.RowSel = Grid.Rows - 1
Grid.ColSel = Grid.Cols - 1
Clipboard.Clear
Clipboard.SetText Grid.Clip, vbCFText

This code will copy the entire grid contents into clipboard.

similarly to paste the data into the clipboard,

1) you should know the exact rows and columns to paste
2)select the rows and columns to paste using rowsel and colsel properties.
3)use this code to paste

Grid.clip = clipboard.gettext()
Enjoy VB
Raja venkatesh
rrv@hotvoice.com

by rrv

This question appears to be answered. i've also answered. i'd like to know which answer was accepted. can you mail to me regarding this. please tell me if my answer helped you also.

rvenkatesh@dubal.co.ae
rrv@hotvoice.com

This discussion is closed to new replies.