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

How to realize the Communication Program with VB.NET

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to achieve VB.NET communication procedures, the article introduces in great detail, has a certain reference value, interested friends must read it!

1992 crescent software inc. The company designs mscomm.vbx user communication controls for vb.

The VB.NET communication program provides the serial communication ability to send and receive data through the serial port, which not only includes the functions completed by all the 16 functions of serial communication in windows api, but also opens up more object attributes that make it convenient for users to design to meet the needs of different users and different services. At present, the introduction of this communication control is rarely mentioned in many domestic vb materials. This paper will introduce the mscomm.vbx communication control and its programming method in detail, and give the basic communication program with an example in the work.

Description of mscomm.vbx communication control

The mscomm.vbx communication control can be used to communicate by adding the form form directly from the toolbox of vb. If there is no such control in toolbox, use tools's custom controls to add mscomm.vbx from the system subdirectory of windows to the toolbox of vb.

1. Letter mode

Mscomm.vbx has two different ways to deal with and solve all kinds of communication software development and design problems.

1) event-driven. It is similar to the window callback function when writing windows software, and is a powerful way to deal with problems. In practical work, we often have to deal with many related events in communication, for example, when the line data arrives at the local end or the state of the CD line and rts signal line changes, we are required to use the corresponding events to track and handle. The control is implemented by using oncomm events, and it also includes problems such as detecting and dealing with communication errors. The commevent value returns the recent communication event or error digital code. Examples of detailed errors and events in VB.NET communication programs are:

Mscomm-er-break

Received 1 break signal

Mscomm-er-cdto cd signal timeout

……

Mscomm-ev-cd cd signal change

……

2) query method. The programmer is responsible for reading the value of commevent and handling errors or events that occur. This approach is usually available for simple application design.

2. Properties of the letter control

Using communication control to program VB.NET communication program, the key is to accurately understand the properties of setting communication control. Mscomm.vbx provides 27 properties about communication controls, such as:

Commport: sets or returns the communication port number.

Settings: sets or returns as a string

The format of data communication: baud rate,

Check, data bit and stop bit.

Portopen: sets or returns the communication port status

(including opening and closing 1 communication port)

……

The above is all the contents of the article "how to realize the Communication Program in VB.NET". Thank you for reading! Hope to share the content to help you, more related 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.

Share To

Development

Wechat

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

12
Report