LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to copy data in multiple cells from the table control and paste it.

Hi,

 

 I am trying to copy data in multiple cell from table control and paste it  to some other cells in the same table control.

For example: 

first two cells data in row 1 and row 2  shud be copied to first two cells in row 4 & row 5.

 

 Kindly suggest me how to do it.

 

 

Thanks in advance,

Venky

 

0 Kudos
Message 1 of 2
(3,609 Views)

A table control is a 2D array of strings. Thus, you have to work within the rules of how to add elements to a 2D array. The primary rule is that it must always be rectangular. The default paste action on a table control will try to insert rows/columns depending on the contents of the clipboard. Thus, if your initial table 2 contained no data, and you tried to paste two cells, they would end up at the top-left corner, not in rows 4 and 5. Even if there were data already present (or just blank cells, which would be empty strings), the paste would not overwrite the contents - it would insert rows/columns.

 

This means you need to override the way the paste works. The easiest way to do this is with an event structure, and you handle the target table control's "Shortcut Menu Selection (App)" event. Here you can use the Point to Row Column method to get the row/column where the cursor was located. Then, you can determine whether to use Replace Array Subset or Insert Into Array to replace the cell contents, or add new ones if the user is pasting beyond the 2D array contents.

Message 2 of 2
(3,597 Views)