>Where can i find samples of how to use copy and paste in a grid.
>
>What i want to do is to be able to select a number of rows in a grid, to copy them in the cliboard and the paste them back in the grid.
>
>This would be usefull to duplicate rows in the grid.
>
>
>Thanks for a little help.
Well, I had done a Copy-n-Paste Form Class for my company needs.
Since there are some special function to handle my company needs, I can't
give you directly but I can give you the routine to do so!!
Rough Form Outlook below:
[x] Copy to Table OldKey NewKey / Copy \ / Quit \
[ITEM \/] [CM-1234-FVC-M] [CM-1268-FVC-M] \ Button/ \ Now /
Grid1
+---
|
|
+---
Grid2
+---
|
|
+---
Because Customer may want to COPY some Quote Sheet detail ITEM into
REAL Order, So the [x]
Copy to Table check button can change to:
Quote to Order for transfer data to another Orditems table..
[ITEM \/] is a Combox of all table allowed to copy within
SAME TableTake above as example, the Same Shape of New Pattern(flower) is created,
Most of the data, such as price, size... are same.
So, Copy it will be much easier to do!
* at txtOldKey.LostFocus
Select * from ITEM where ITEMKEY = ALLTIRM(this.Value) into Table ;
C:\TEMP\RWCopy
* at txtNewKey.LostFocus
Select * from ITEM where ITEMKEY = ALLTIRM(this.Value) into Table ;
C:\TEMP\RWCheck
So, after user type in Newkey, it give a general search to check if
it already Exist or not in ITEM table at Grid2!!!
Then, I ask user to
Mark Delete in Grid1 for Non-Needed Data!
Finally need to do is to:
* cmdCopy.Click
set Delete On
Append From C:\temp\RWCopyThus, for example, Customer want to RE-Order again with a little bit change
from previous Order, What I need to do is to Mark Delete for non-needed
OrdItems at Grid1 and Copy to main OrdItems.
Since the Temp Result table is Put at C:\Temp, Generally no problem for
network multi-user unless run twice at same PC.. ~_~
To Copy across another Table, QuoItems to OrdItems...
You only need to modify the SQL for grid1
* txtNewKey.LostFocus
Select
alltrim(this.value) as Ord_id, * from QuoITEMs ;
Where ... into table RWCopy
So, when do
Append From C:\temp\RWcopy, VFP will copy the
Corresponding FieldName to OrdITEMs and do what you wants!!
To Summary, to do Copy-n-paste is:
Select ... into table C:\temp\RwCopy
Set Delete On
Append from C:\temp\RwCopy
You can print out this message and do it!
About 2 days can finish it even for beginer! ~_^ Good Luck!
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.