I was wondering if there is a way to group controls together without using any containers such as panel, group box, or container.
You can put them into a list or dictionary or array.
Public Class Form1 Private GroupedControls As New List(Of Control) Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load GroupedControls.Add(Me.Button1) GroupedControls.Add(Me.Button2) GroupedControls.Add(Me.Button3) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click For Each Control As Control In GroupedControls If Control.Equals(sender) Then Control.Text = "Button Two" End If Next End Sub End Class
Not exactly sure what you mean. If you wanted to group them in the UI then you would use a panel or other thing you specify not with.
This is what i am trying to do.
I have multiple textboxes that needs to be refreshed or altered per user's action.
These textboxes are all over the form and I am unable to put them in a panel or a group box.
But I dont want to have to create a line of code for each one of them because they all take same action once the user makes changes to the form.
So I was wondering if I can group them together and call them by the group name each time I need to alter these textboxes.
I think the first solution that you have above is the one that I've been looking for.
this is a random question but how do i mark my thread solved?
At the bottom of the thread, above the quick reply box, there is a question "Has this thread been answered?" with a link "Mark this Thread as Solved". Click the link.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Private Sub btn_addline_Click(ByVal ...