In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how VB.NET deletes controls. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
When a control is a child of another control, for example, there are three child pictruebox in pictruebox, and the names of the child controls are stored in known variables, when we want to delete any of these controls, we can use the following methods:
Take a look at a piece of code first:
Control the state of the control
Private Sub mHDR_Control_Status
(ByVal p_Enabled As Boolean)
Dim iControls As Integer
Dim i As Integer
IControls = Me.gbxVoyage_HDR.
Controls.Count
For I = 0 To iControls-1
If TypeOf (Me.gbxVoyage_HDR.
Controls (I)) Is TextBox Or _
TypeOf (Me.gbxVoyage_HDR.Controls (I))
Is Infragistics.Win.Misc.UltraButton Then
Me.gbxVoyage_HDR.Controls (I).
Enabled = p_Enabled
End If
Next
DtpLoad_ETD.Enabled = p_Enabled
If gLoad_Type = "0" Then
BtnSave.Enabled = p_Enabled
BtnEdit.Enabled = Not p_Enabled
Else
BtnSave.Enabled = False
BtnEdit.Enabled = False
End If
TxtVoyageNO.Enabled = False
End Sub
To put it simply, use Me.gbxVoyage_HDR.Controls (I)), and if there are controls in the control, add Controls (I) to control Me.gbxVoyage_HDR.Controls (I) .controls (I).
Going back to the previous assumption, there are three more sub-pictruebox in pictruebox, and the main code to delete any one of them is as follows:
Public pics (1000) As System.
Windows.Forms.PictureBox
Dim pic1 as new New PictureBox
Dim pic2 as new New PictureBox
Dim pic3 as new New PictureBox
Dim j as integer=0
Dim Mainpic as new New PictureBox
Mainpic .Controls.add (pic1)
Pics (j) = pic1
Jackpot 1
Mainpic .Controls.add (pic2)
Pics (j) = pic2
Jackpot 1
Mainpic .Controls.add (pic3)
Pics (j) = pic3
Jackpot 1
An array of controls is used. When VB.NET deletes controls, delete them all: Mainpic .Controls.Clear ()
When VB.NET deletes the j control in the control: Mainpic .Controls.Remove (pics (j))
Thank you for reading! This is the end of this article on "how to delete controls in VB.NET". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.