Software Control Code Writing Thinking

xiaoxiao2021-03-06  56

1. Do not use an exception prompt, which only allows the customer to think that the program is wrong, such as Catch (Exception & E) {showMessage; Return False;}

2. Check the correctness to determine if the character is made before the character is converted, and the function is provided with the function of the digital judgment in the C language. Need yourself, rather than using capture conversion exceptions (str.todouble ()) to determine the input digital validity. ISNUMERIC (STR) can be judged in VB

3. Some inputs need to instantly determine the input validity, calculate another display item, if the input is invalid, it is best not to pop up the mode form, because the instant judgment is generally used to one-ITEXIT and other events, when the mode form is pop-up, The pop-up form obtains the focus, inevitably calls the OneDiteXit event, turns off the mode form, and this time the original form is not the original control when using the judgment, the personal suggestion of the status bar of the child is still other. Probably a prompt of focus.

4. Try the input when the input is submitted. If there are multiple ONXXEXIT events, it is best to place FOCUS to locate the control without ONXXXETER and ONXXXIXIT, you should get as much error input as much as possible, and the branch is displayed instead of discovering An error message once. IF (! isvaliddata (stra)) Strerr = "stra"; if (! isvaliddata (strb)) strerr = "strb"; if (STRERR! = ") {ShowMessage (STRERR); // At this time ShowMessage Return;}

5. Pay attention to multiple associated controls. For example, when calculating foreign currency is converted into RMB, there are three input boxes, exchange rates, foreign currency amounts, renminbi, three input boxes, exchange rates and foreign currency amounts, and re-calculate the renminbi amount. The two input boxes need to be added with the onxxxexit code, lacking one may be wrong.

转载请注明原文地址:https://www.9cbs.com/read-110372.html

New Post(0)