I have a 2 dimensiononal Button array, that i created with this code
Expand|Select|Wrap|Line Numbers
- Public Class Form1
- Public btn_array(5, 5) As Button
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- For i As Integer = 0 To 5
- For j As Integer = 0 To 5
- btn_array(i, j) = New Button
- Me.Controls.Add(btn_array(i, j))
- btn_array(i, j).Location = New Point(10 + i * 75, 10 + j * 30)
- btn_array(i, j).Text = "Button(" & i & "," & j & ")"
- Next
- Next
- End Sub
- End Class
Lets say i want to run the following sub, that messages me the i and the j indexes of the clicked button.
Expand|Select|Wrap|Line Numbers
- Private Sub One_of_the_buttons_has_been_clicked(ByVal sender As System.Object, ByVal e As System.EventArgs)
- MsgBox(" You have clicked Button " & i & j )
- End Sub
I would be grateful if anyone could show me a way to archive my goal.
And some information about my developer enviroment
Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727
Installed Edition: Professional
Microsoft Visual Basic 2005 77626-009-0000007-41551
Microsoft Visual Basic 2005
Thanks for reading 'till this :)