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

Summary of skills related to VB.NET property setting

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

Share

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

This article mainly explains the "summary of skills related to VB.NET property setting". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "summary of skills related to VB.NET attribute setting".

There are many ways to set the VB.NET property, and its application is also very important in practical programming. When the user can set or get the value of the property, these properties are changing. This property can be changed at design time. Users can set the values of these properties in the properties window without writing any code, and some code cannot be changed at design time, so some code that sets the values of these properties must be written in the running program.

Properties that can be set and read at run time are called "read-write" properties. Code that can only be read at run time is called the "read-only" attribute.

The VB.NET property setting is 1. Set property value

When you need to change the appearance or behavior of an object, you can change the property value of the object. For example, you can change the contents of a textbox by changing the value of the Textbox property of the Textbox control.

To set the value of a property, you can use the following syntax

Object.property=expression

Some examples are as follows:

TextBox1.Top=200 'Let the Top attribute value be 200TextBox1.Visible=True' display TextBox TextBox1.Text= "hello" 'display "hello" in TextBox

The VB.NET property setting 2. Get the value of the attribute

When the code wants to do something on an object, the user may need to get the state of an object, for example, when making the next operation on a TextBox control, he may need to know the value of the text property of TextBox, and so on.

Typically, the user can get the property value of an object with the following syntax:

Variable=object.property

Users can treat the property value of an object as part of a complex expression without first assigning the property value to a variable and then evaluating it. The following example is the code that changes the property of a radio button:

Private Sub cmdAdd_Click ()

'[statements]

RadioButton1RadioButton1.

Top=RadioButton1.top+20

'[statements]

End Sub

Note: if the user needs to use a property value multiple times in the VB.NET property setting, assigning the property value to a variable first will make it more efficient.

Thank you for your reading, the above is the "VB.NET property setting skills summary" content, after the study of this article, I believe you have a deeper understanding of the VB.NET attribute setting skills summary of this problem, the specific use of the need for you to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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