Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 31st, 2011, 07:58 AM
gingernob gingernob is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2010
Posts: 6 gingernob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 14 m 41 sec
Reputation Power: 0
Control looping problem for newbie

Hi there

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
Do
ctl = Me.GetNextControl(ctl, True)
If ctl IsNot Nothing Then
' Search for a TextBox
If TypeOf ctl Is PictureBox Then
'MessageBox.Show(ctl.Name)
Code:
Original - Code
    bmp = ctl.Image

LstCount = LstCount + 1)
End If
End If
Loop Until ctl Is Nothing
MsgBox(LstCount)

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.
Regards
David
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.

Reply With Quote
  #2  
Old November 1st, 2011, 06:59 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,257 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 19 h 1 m 26 sec
Reputation Power: 4445
What version of vb?

You probably should be looking at a for each loop
Comments on this post
medialint agrees: Yes, a for .. each would help
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #3  
Old December 7th, 2011, 04:50 PM
the-listener the-listener is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 23 the-listener User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 48 m 40 sec
Reputation Power: 0
you need to show the problem

Quote:
Originally Posted by gingernob
Hi there

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
Do
ctl = Me.GetNextControl(ctl, True)
If ctl IsNot Nothing Then
' Search for a TextBox
If TypeOf ctl Is PictureBox Then
'MessageBox.Show(ctl.Name)
Code:
Original - Code
    bmp = ctl.Image

LstCount = LstCount + 1)
End If
End If
Loop Until ctl Is Nothing
MsgBox(LstCount)

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.
Regards
David
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.


doug has suggested a different loop structure that would simplyfy some of you code and stop you walking beyond the controls on your form...

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Control looping problem for newbie

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap