Vb.Net - Class to Change Textbox BackColor Dynamically

前端 未结 2 960
借酒劲吻你
借酒劲吻你 2021-01-15 16:51

I\'d like to know how to create a Class to change each textbox BackColor inside a Form. To be more Specific:

  1. When the textbox Is Empty, the textbox BackColor e
2条回答
  •  走了就别回头了
    2021-01-15 17:14

    You can create a class that has a collection of textbox controls. You can get this collection going through the Controls property of your Form or user control and verifying the type of the control. Internally the class must subscribe to the events you've listed, of the textbox controls collection. Finally, on the methods that handle the events you must write the logic that change the color accordingly. Remember that the handle events methods have the control that triggered the event on the first parameter.

    I can go into more detail if you have more doubts.

提交回复
热议问题