In the usual knocking system, did you ever encounter the need to let the TextBox control or other controls display the contents of empty, before the direct method is directly equal to null value, if such a control has many, all need null value, it is necessary to set its value is empty, it is obviously a stupid way, there is no better way to let it, The answer is yes.
In the development. When netwindows an application, we all use controls that System.Windows.Forms namespaces. namespaces to encapsulate the controls we use into classes, and when we use them, we instantiate these classes as the controls we need. These are the molds, and the molds are placed in a place called control. The control class is important because it is the parent class for Windows visual components. The control class implements the most basic functionality required for a class that displays information to the user. It handles the input that the user makes through the keyboard and the pointing device. It also handles message routing and security. Although it does not implement drawing, it defines the bounds of the control (its position and size). It provides a window handle (hWnd).
We can also develop new controls based on existing controls while using the controls that Microsoft provides to us. When developing custom controls, we can use existing controls or extend the control or UserControl classes. Extending the control or UserControl class means we need to overwrite the OnPaint method and draw our own graphical user interface. We can study how to do this.
Knowing the basics, let's get to the point--how to make the contents of the control empty
My Code is
Dim C as Control ' defines a control class
for every C in Me.GroupBox1.Controls ' Loop GroupBox1 the content of Controls in a form
LCase (TypeName (c)) = "TextBox" Then ' If the class name is textbox
c.text = " ' His value is null end
if
Next
The current understanding of control only stays on the surface, hoping to deepen his understanding through continuous learning.