Author: Xingda Computer technology company (www.study01job.com) Guo Baoli
Data Entry window has a lot of common programs, here for a simple summary, and then the reader can consider the use of inheritance, user objects and other ways to encapsulate these common content in order to reuse in the future development, so as to improve the software development efficiency. The common procedures summarize the following points:
1. Insert
Usually provides a command button that writes the following script in the button's clicked event:
Dw_1.scrolltorow (Dw_1.insertrow (0))
2, delete
Usually provides a command button that writes the following script in the button's clicked event:
Integer li_flag
long ll_currow
ll_currow = dw_1.getrow (0)
if Ll_currow < 1 then return
Li_flag = Messa Gebox (' Hint ', ' Are you sure you want to delete the current data? ', question!,yesno!,2)
If Li_flag = 1 then
dw_1.deleterow (ll_currow) End
If
3, provide a close button, the button on the clicked event to write the following script:
Close (parent)
4, provide a Save button, the button on the clicked event to write the following script:
Long ll_rows
ll_rows = dw_1.modifiedcount () + dw_1.deletedcount ()
if ll_rows < 1 then return
if Dw_1.updat E () = 1 then
commit;
MessageBox (' Hint ', ' data saved successfully. Saved ' + String (ll_rows) + ' data. ')
else
rollback;
MessageBox (' Hint ', ' data error, love carefully check. ') End
if
5. Write the following script in the constructor event of the Data window control dw_1:
This.settransobject (SQLCA)
Write the following script in the Dberror event:
Return 1
Write the following script in the Itemerror event:
Return 1
Write the following script in the Losefocus event:
This.accepttext ()