Results 1 to 6 of 6

Thread: [RESOLVED] picture boxes visual basic 2008.....

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    14

    Resolved [RESOLVED] picture boxes visual basic 2008.....

    hey everyone!!!
    well i am programming in vb 2008 and i hav a little problemo.....
    I hav added 8 picture boxes in my application and i wana know if i can go through all those 8 picture boxes in a "FOR LOOP" ...something lyk this....

    Code:
    for i=0 to 7 step 1
    picturebox(i).image=image.fromfile(path)
    now the problem is that i am not allowed to use "picturebox(i)" .... is there a way to go through all the picture boxes in a for loop???

    any help wud b appriciated......

  2. #2
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    739

    Re: picture boxes visual basic 2008.....

    This is a .Net question posted in the vb6 forum - i guess the mods will move this thread soon.

    I've never done this but on the .net forum we discussed things like this just a couple of days ago. Search for "Control Arrays".

    It appears that something like this may work. Create your picture boxes on your form picturebox1, picturbox2, picturebox3 etc

    Then in your loop you can refer to them like this:-
    for i = 1 to 7
    me.controls("PictureBox" & i).image = someimage
    next i

    As I said, I've never done that before so the syntax may not be accurate but it may put you on the right track

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    14

    Re: picture boxes visual basic 2008.....

    thx for ur reply.....
    i am sory for posting this in wrong section....

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: picture boxes visual basic 2008.....

    Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    14

    Re: picture boxes visual basic 2008.....

    ok problemo solved...... this topic can be closed.....

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: picture boxes visual basic 2008.....

    In that case please mark the thread as Resolved, via the "Thread tools" menu just above the first post in this thread, then "Mark thread resolved". (like various other features of this site, you need JavaScript enabled in your browser for this to work).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width