October 31st, 2011, 07:58 AM
Control looping problem for newbie
i have a relatively simple task which is driving me mad!!
I have 80 picturebox's on a form and want to loop through each one to 'save' the name only (not the image) of the image. i have tried:
LstCount = 0
Dim bmp As Bitmap
Dim ctl As Control = Me
ctl = Me.GetNextControl(ctl, True)
If ctl IsNot Nothing Then
' Search for a TextBox
If TypeOf ctl Is PictureBox Then
LstCount = LstCount + 1)
Loop Until ctl Is Nothing
The messagebox.show works with presenting the picbox control names but if i try to use the .image syntax it says the 'image' is not a member of the system.windows.forms.control.!!
Any help please.
ps, once i have the image name im going to pass it off to a 'save' option and write each name and image name to a seperate file.
November 1st, 2011, 06:59 PM
What version of vb?
You probably should be looking at a for each loop
Comments on this post
I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton
December 7th, 2011, 04:50 PM
you need to show the problem
doug has suggested a different loop structure that would simplyfy some of you code and stop you walking beyond the controls on your form...
Originally Posted by gingernob
but that is not the issue here
the problem is that you have not included an example that works and what is gives you and the example of what you have tried and failed with.
simply saying the message box worked with the ctl but not the .image does not show how you sued these words witin your code
post some more!
bill stewart - here to listen