crazymarvin
Member
How can you find out if a picture box contains an image or is just empty? I want to be able to use a loop to empty all my picture boxes, however if one of them doesnt contain an image i get a runtime error. Here is the code I have so far:
VB.NET:
Dim counter As Integer
For counter = 1 To 9
Dim cntrl_name As String
cntrl_name = "picBox" & CStr(counter)
Panel1.Controls(cntrl_name).BackgroundImage.Dispose()
Next