 |
VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
garfield Site Admin

註冊時間: 2003-01-30 文章: 2160
第 1 樓
|
發表於: 星期二 四月 27, 2004 12:48 am 文章主題: 如何將一筆資料上下搬動, 及插入一筆空白資料 |
|
|
但原則上這個工作區不可以有設定索引序.
DO MoveRecordSet 之後就可以使用 Hot Key 方式工作.
代碼: |
Func MoveRecordSet
On KEY LABEL CTRL+PGUP DO MOVERECNO WITH -1 && 將資料往上/下搬動一筆
On KEY LABEL CTRL+PGDN DO MOVERECNO WITH 1 && 將資料往上/下搬動一筆
on key label CTRL+LEFTARROW do deleterec
on key label CTRL+RIGHTARROW do insertrec
Return
* 將資料往上/下搬動一筆
Func MOVERECNO
Lpara UP_DOWN
Private TEMP , TEMP1 , pass
Scat TO TEMP MEMO
Pass = RECNO()
Skip UP_DOWN
If !BOF() .AND. !EOF()
Scat TO TEMP1 MEMO
Gath FROM TEMP MEMO
Go pass
Gath FROM TEMP1 MEMO
If UP_DOWN = -1
Keyb '{UPARROW}'
Else
Keyb '{DNARROW}'
Endif
Else
Go pass
Endif
Return
**********
func deleterec
mrec = recno()
msele = select()
do while !eof()
skip
if eof()
exit
endif
scat to temp
skip -1
gath from temp
skip
enddo
go bott
dele
go mrec
********************
func insertrec
mrec = recno()
msele = select()
scat to temp
copy to temp rest
appe blank
go mrec
gath from temp
skip
use temp in 0
do while !eof()
sele temp
scat to temp
skip
sele (msele)
gath from temp
skip
enddo
use in temp
go mrec
|
_________________ 利用>>搜尋<<的功能會比問的還要快得到答案. |
|
回頂端 |
|
 |
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
|
|