Need Help with this code:

Heavenly

Well-known member
Joined
Aug 22, 2005
Messages
53
Location
Puerto Rico
Programming Experience
1-3
Need Help with this code:

This is what I have:

Every time I click on button1:
VB.NET:
DisplayPhoto(PictureBox1, arrProductNumber(0))
I call this sub:
VB.NET:
	Sub DisplayPhoto(ByVal PhotoFrame As PictureBox, ByVal j As Integer)
		PhotoFrame.Image = System.Drawing.Image.FromFile(Application.StartupPath & "\photos\" & j & ".jpg")
	End Sub
The problem is that I just do not know how to increment the variable and the array (PictureBox1, arrProductNumber(0))so the next time I click, my arguments should be (PictureBox2, arrProductNumber(1))

I thought about putting this on button1 click event:
VB.NET:
arrProductNumber(0) = arrProductNumber(0) + 1
But I’m not sure if this is correct and I have not idea what to do with the Picturebox1. Can anyone give me a suggestion?

Thanks
 
take a counter variable

take a counter variable and make it an array index

like:-

dim count as integer=0

and refer array as arrProductNumber(count)

and then increment count
 
How would I increment to the next PictureBox?


first button click should place the image in
PictureBox1

next button click should place the image in
PictureBox2

so on and so forth..
 
TabIndex or Tag Property

Although Visual Basic .NET controls do not have an Index property, you can duplicate the functionality using another common property such as the TabIndex or Tag property.

I haven't coded it yet but as soon as i do it...i'll post it...till then maybe someone else might help you
 
sunnypalsingh:


If you do decide to write the code could it be posible to do it using the TAG property?

I always wanted to learn how the TAG works in code. Will love to see how it is used.
 
Back
Top