Visual Basic 2010 でクリックされた PictureBox 配列要素のインデックスとタグを知る必要があります。 タグとインデックスは Public Integer 変数として淡色表示されます。Gboxは PictureBox 配列の名前です。Tag = sender.tagが機能します。 Index = NameofArray.Indexof(sender as PictureBox)は機能せず、 Index = clicked.Indexof(sender as PictureBox) も機能しません。
Private Sub Gbox_Click(sender As Object, e As EventArgs)
Dim clicked As PictureBox = CType(sender, PictureBox)
SelectedColor.Image = clicked.Image
Tag = sender.tag
Index = Gbox.IndexOf(sender as picturebox) 'Does not work
Index = clicked.Indexof(sender as PictureBox) ' Does not work
End Sub
事前に割り当てられたタグとインデックスを計算で使用する必要があります。あなたの助けに感謝します。