Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Arrays, Can you make many Images into an array?

Boogy_ManBoogy_Man Member Posts: 4
I have 160 images. They are all named Box1 to Box160 (each has a different number). I was wondering if you could change the properties of each box without doing 160 lines of code. Heres what I had in mind but it obviously doesn't work.
-Index is a interger
-boxviz is my array
-Box is the image and index is the number that follows it

For Index = 1 To 160
If boxviz(Index) = 1 Then
Box(Index).Visible = False
End If
Index = Index + 1
Next Index

Help Please!

Comments

  • nimnul2nimnul2 Member Posts: 131
    Try this modified lines of your code:



    For Index = 1 To 160
    Box(Index).Visible = False
    Index = Index + 1
    Next Index
  • DarQDarQ Member Posts: 1,625
    Why increase Index twice? The default increase value for a For Next loop is 1 and you also increase by doing Index = Index + 1.

    Ofcourse, don't forget to set the image propery Index for the 160 images you use.

    : Try this modified lines of your code:
    :
    :
    :
    : For Index = 1 To 160
    : Box(Index).Visible = False
    : Index = Index + 1
    : Next Index
    :

    [HR]
    [GREEN]
    roodgebefteblauwebreedbeeldbekbaviaan
    especially for in your kitchen.
    [/GREEN]
    [HR]
    [PURPLE]
    http://www.programmersheaven.com/c/MsgBoard/boardinfo.asp?BoardID=455
    [/PURPLE]
    [HR]

  • Andre YoungAndre Young USAMember Posts: 0

    _______ [ http://forcoder.org ] free video tutorials and ebooks about \ Scratch, Swift, C#, PHP, JavaScript, PL/SQL, Assembly, Ruby, Delphi, Perl, R, Objective-C, Visual Basic .NET, Go, Visual Basic, Java, MATLAB, Python, C, C++ Logo, Bash, Scala, Prolog, Apex, SAS, Alice, Erlang, VBScript, Lisp, Crystal, FoxPro, LabVIEW, Lua, Rust, Dart, ABAP, Transact-SQL, Hack, F#, Awk, Kotlin, D, Ada, Julia, Fortran, Clojure, ML, Scheme, COBOL \ ______

Sign In or Register to comment.