|
-
Apr 11th, 2003, 08:36 AM
#1
Thread Starter
Hyperactive Member
Object arrays?
Is it possible to make an array of and object (like in VB6) such as
Button(1).text="Hello"
Button(2).text="hello2"
you could do it in vb6 by simply copying and pasting an object and it would allow you to decide if you wanted it an array or not.
-
Apr 11th, 2003, 09:19 AM
#2
Registered User
No, .NET doesn't allow for control arrays. What you can do, however, is create a standard event that handles the click event for a number of buttons. For example:
Private Sub ButtonClick_Click(ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click
Dim oButton as Button
oButton = sender
Select Case oButton.Name
Case "Button1"
Case "Button2"
Case "Button3"
End Select
End Sub
This seems to work pretty well. Hope it helps!
-
Apr 11th, 2003, 02:27 PM
#3
yay gay
the way you use controls array is though collections
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|