kimosavi
Active member
Hi. Have been experimenting with VB.NET and seems awesome!
I am trying to do something and need to see if there is an easier way.
I have 50 pictureboxes in one form. I need to write the same code for each one.
I understand I can do this in two ways
one is to write a function for each PictureBox handling each object induvidually
two is to write a function for all PictureBoxes that handle ALL object, but I have to declare each object in the Handles syntax of the subrutine
as follows:
I was wondering if there is a way to write a subrutine that will Handle ALL Pictureboxes without having to enumerate them.
example
is it possible, could anyone point me into the right direction
Thanks!!
Kimo
I am trying to do something and need to see if there is an easier way.
I have 50 pictureboxes in one form. I need to write the same code for each one.
I understand I can do this in two ways
one is to write a function for each PictureBox handling each object induvidually
two is to write a function for all PictureBoxes that handle ALL object, but I have to declare each object in the Handles syntax of the subrutine
as follows:
VB.NET:
Private Sub PreviewTile(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PB1.DoubleClick, PB2.DoubleClick, PBChapel.DoubleClick
DrawBorder(sender, Color.Wheat, 3)
frmBoardPreview.PBPreview.Image = FindPicture("TB", sender.Tag)
frmBoardPreview.Show()
End Sub
I was wondering if there is a way to write a subrutine that will Handle ALL Pictureboxes without having to enumerate them.
example
VB.NET:
Private Sub PreviewTile(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.PictureBoxes.DoubleClick '<-- made up
DrawBorder(sender, Color.Wheat, 3)
frmBoardPreview.PBPreview.Image = FindPicture("TB", sender.Tag)
frmBoardPreview.Show()
End Sub
is it possible, could anyone point me into the right direction
Thanks!!
Kimo