In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I would like to talk to you about what the VB.NET Sub process is like, many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.
The emergence of the VB.NET programming language is undoubtedly a good thing for developers. They can use it to easily implement many functions. Where the VB.NET Sub procedure is a block of code that is executed in response to the event. After dividing the code in the module into Sub procedures, it becomes easier to find and modify the code in the application. The syntax of the Sub procedure is:
{Private | Public | Friend}
Sub subname
([arguments list])
Statements
End Sub
Where arguments list is a list of parameters, which can be declared just like a variable.
What is the life cycle of VB.NET objects
Summary of skills related to VB.NET property setting
Parsing the implementation of VB.NET object variable declaration
Operation skills related to VB.NET String data types
Introduction to the implementation method of VB.NET custom type
Each time the VB.NET Sub procedure is called, the statements between Sub and End Sub is executed. You can put subprocedures into standard modules and class modules. By default, subprocedures in all modules are Public (common), which means they can be called anywhere in the application. In Visual Basic, we should distinguish between general process and event process.
1. General process
The generic VB.NET Sub process tells the application how to accomplish a specified task. Once the generic procedure is determined, it must be called by a proprietary application. Conversely, the event procedure is usually idle before it is called in response to a user-raised event or a system-raised event. The purpose of establishing a general process is to "bring up" the same statement to be executed by several different event procedures. Put a common statement into a separate procedure (a general procedure) and call it by events so that you don't have to repeat the code and it's easy to maintain the application.
The idea of process-oriented programming is that each event corresponds to the corresponding process. generally speaking, the size of the process should be between 60 and 200 lines of code. if it is less than this range, it is necessary to consider whether the process needs to be proposed separately, and if it is larger than this range, we should consider whether we should refine the large process, and a good program style will always see its hierarchical relationship, that is, the procedure has the subprocedures it needs to call. And the parent procedure that calls it.
two。 Event process
When an object in Visual Basic determines the occurrence of an event, it automatically calls the procedure of the event with the name corresponding to the event. Because the name establishes a connection between the object and the code, the event procedure is attached to the form and control.
(1) the event procedure of a control combines the actual name of the control (specified in the Name property), the underscore (_), and the event name.
For example, if you want to call an event procedure after clicking a command button named btnPlay, use the btnPlay_Click procedure.
(2) A form event procedure combines the form's namespace, underscore, and event name. If you want the form to call the event procedure after you click it, use the Form_Click procedure (like the control, the form has a unique name, but you cannot use these names in the name of the event procedure. )
Although users can write their own event procedures, it is more convenient to use the code procedure provided by Visual Basic, which automatically includes the correct procedure name. Select an object from the object Box and a procedure from the procedure Box to select a template in the Code Editor window. Set the Name property of the control before you begin to write events for the control, which avoids some potential errors at compile time. If you attach a VB.NET Sub procedure to a control and then change the name of the control, you must also change the name of the procedure to match the new name of the control. Otherwise, Visual Basic cannot match the control to the process. When the procedure name does not match the control name, the procedure becomes a generic procedure.
After reading the above, do you have any further understanding of the VB.NET Sub process? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.