In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use the VB.NET framework class library, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
VB.NET after a long period of development, many users are very familiar with VB.NET, here I would like to publish a personal understanding, and discuss with you about the VB.NET framework class library. Timers usually play an important role in both client applications and server components (including window services). Writing efficient timer-driven manageable code requires a clear understanding of the program flow and mastering the subtleties of the .NET threading model. The VB.NET framework class library provides three different timer classes: System.Windows.Forms.Timer, System.Timers.Timer, and System.Threading.Timer. Each class is designed and optimized for different situations. This article will examine these three classes and let you understand how and when you should use which class.
The timer object in Microsoft ®Windows ®allows you to control when a behavior occurs. Some of the most common uses of timers are to start a process regularly, to set intervals between events, and to maintain a fixed animation speed when working on graphics (regardless of the speed of the processor). In the past, timers were even used to simulate multitasking for developers using Visual Basic ®.
As you might expect, Microsoft has equipped you with some tools for the different situations you need to deal with. There are three different timer classes in the VB.NET framework class library: System.Windows.Forms.Timer,System.Timers.Timer, and System.Threading.Timer. The first two classes appear in the toolbox window of Visual Studio ®.NET, and both timer controls allow you to drag and drop them directly onto the Windows forms designer or component class designer. If you are not careful, this is the beginning of the trouble.
Both the Windows forms page and the component page (see Figure 1) on the Visual Studio .NET toolkit have timer controls. It's very easy to misuse one of them, or worse, you don't even realize the difference. Use the timer control on the Windows forms page only if the target is the Windows forms designer. This control will place an instance of the Systems.Windows.Forms.Timer class on your form. Like other controls on the toolbox, you can let Visual Studio .NET handle its generation or you can manually instantiate and initialize the class.
The use of timer classes in the VB.NET framework class library:
Figure 1 timer control
Timer controls on the component page can be safely used in any class. This control creates an instance of the System.Timers.Timer class. If you are using the Visual Studio .NET toolkit, you can safely use this class whether it is a Windows forms designer or a component class designer. Use the component Class designer in Visual Studio .NET when you design a class that derives from System.ComponentModel.Component. The System.Threading.Timer class does not appear on the Visual Studio .NET toolbox window. It's a little more complex but provides a higher-level control, as you'll see later in this article.
Figure 2 example program
Let's first look at the System.Windows.Forms.Timer and System.Timers.Timer classes. The two classes have very similar object models. I'll explore the more advanced System.Threading.Timer classes later. Figure 2 is a screenshot of the example program that I will refer to throughout the article. This application will give you a clear understanding of these timer classes. You can download the complete code from the link at the beginning of this article and try it out.
The above is all the contents of this article entitled "how to use the VB.NET Framework Class Library". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.