The common program of PB Data Entry window

Source: Internet
Author: User

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 ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.