Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does the VB.NET event mean?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you what the VB.NET event refers to. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

VB.NET after a long period of development, many users are very familiar with the VB.NET event, here I would like to post a personal understanding, and discuss with you. Calling the thread's start method does not guarantee that the method is executed immediately, and you must wait for the method to finish executing in order to get the result of data access.

If the use of a circular query after running a thread obviously affects interactivity, events are a good way to return data from a thread method. Simply define an event in the class where the thread method is located, emit the event in the thread method, and generate a proxy in the form class. Threads are the basic unit in which the operating system allocates processor time. Threads can run multiple activities while a single thread executes. Operating systems that support preemptive multitasking can create multiple threads and make them run at the same time through time slice rotation. In applications that require good user interaction and applications that communicate with networks and databases, the use of multithreading can provide a good interactive experience and respond quickly to the requirements of users.

First, add the VB.NET event after the dealDataBase class declaration:

Public Class dealDataBase Public Event GetDataComplete (ByVal e As DtatTable) … End Class

Add the code that emits the event in the GetDataFromDataBase () method of class dealDataBase, and put it after m_sqlDataAdapter.Fill (m_table):

Public sub GetDataFromDataBase ()... M_sqlDataAdapter.Fill (m_table) RasiseEvent GetDataComplete (m_table)... End Sub

Let's generate a proxy in the form class

Private Sub dealData (ByVal e As DataTable) 'processing datasheet End Sub

Event concatenation is made in the code that creates and runs the thread, the event connection code is placed before the running thread, and after the dealDataBase class is instantiated:

AddHandler myDB. GetDataComplete,AddressOf dealData

In this way, when the thread method finishes executing, the event is emitted, and the dealData method responds to the VB.NET event and handles it.

This is what the VB.NET event shared by the editor refers to. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are 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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report