Because the data room charging system has many forms and controls, it sometimes needs to operate on multiple objects. In this case, the object set will save a lotCodeQuantity. Code is time, and time is life. The more streamlined, the better the efficiency.
1, Form set
Implement a function in the charging system:When a form is opened, other opened forms must be minimized. The implementation is as follows:
Private sub form_activate () 'minimizes dim frmcurr as form for each frmcurr in forms if frmcurr. name <> "frmmain" and frmcurr. name <> "frmmainshow" and frmcurr. name <> me. name then frmcurr. windowstate = 1 end if next frmcurrend sub
2. Control Set
For example, all text boxes except the card number are cleared: (two methods)
Method 1:
'Aside from the card number, clear all text boxes dim mycontrol as control for each mycontrol in me. controls if typeof mycontrol is textbox then if mycontrol. name <> "txtcardno" then mycontrol. TEXT = "" end if next
Method 2:
Dim mycontrol as Controlfor each mycontrol in me. controls if typename (mycontrol) = "textbox" then mycontrol. Text = "" End ifnext