Thanks for your relation :) My problem is picturebox.I create 30 picturebox with code.And I add they events.
For i = 1 To adet
p(i) = New PictureBox
p(i).Location = New Point(10, (i * 150) - 140 + (i - 1) * 10)
p(i).Size = New Size(150, 150)
p(i).BorderStyle = BorderStyle.FixedSingle
Me.Panel1.Controls.Add(p(i))
Me.Panel1.AutoScroll = True
AddHandler p(i).Click, AddressOf Me.hesapla '''''hesapla is a sub :)
Next i
MY PROBLEM:
I want to know which picturebox is clicked ? What can I do ?
Loading
Scott LyslePosted Apr 12, 2007, 1:56 AM
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim p(5) As PictureBox
Dim i As Integer For i = 0 To 4
p(i) = New PictureBox
p(i).BackColor = Color.Aqua
p(i).Name = "pBox" & i.ToString()
p(i).Location = New Point(10, (i * 150) - 140 + (i - 1) * 10)
p(i).Size = New Size(150, 150)
p(i).BorderStyle = BorderStyle.FixedSingle
Me.Controls.Add(p(i))
Me.AutoScroll = True
AddHandler p(i).Click, AddressOf Me.hesapla
Next i
End Sub Private Sub hesapla(ByVal sender As System.Object, ByVal e As System.EventArgs)
MessageBox.Show(sender.Name.ToString())
sender.BackColor = Color.Black
End Sub