Results 1 to 3 of 3

Thread: i need help

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Location
    Maryland
    Posts
    1

    Question

    okay heres the deal in the following code i want to be able to refer to an object from a string i built to specify the correct picture box

    Private Sub Form_Load()

    Box_Base_String = "Box_col"
    Col = 1
    Row = 1

    While Col < 9

    Box_Fill_String = Box_Base_String + Str(Col) + "_" + Str(Row)

    Box_Fill_String LoadPicture(CurDir & "\grass_bg.gif")

    <okay here is the spot i want the string Box_Fill_String 's value to be read as the object name can i do this>

    If Row < 9 Then
    Row = Row + 1
    Else
    Row = 1
    Col = Col + 1
    End If

    Wend

    End Sub


    if anyone can help i would be very happy
    i know this is most likly badly written code but i teach myself as i go so i think i do alright
    so any help?

    just because i'm parinoid doesnt mean someone isnt behind me

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I don't believe you can do what you want, but one suggestion I can make is to change

    Box_Fill_String = Box_Base_String + Str(Col) + "_" + Str(Row)

    to

    Box_Fill_String = Box_Base_String & Str(Col) & "_" & Str(Row)


    While concatenating strings with "+" works most of the time, VB will, if it can, ADD the values.

  3. #3
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Boulder, Colorado, USA
    Posts
    325
    I really don't understand what you are trying to do

    what is this?

    Box_Fill_String = Box_Base_String + Str(Col) + "_" + Str(Row)

    '' I assume you mean ' = ' after Box_Fill_String
    Box_Fill_String LoadPicture(CurDir & "\grass_bg.gif")


    Box_Fill_String is a string not a picture object

    as far as setting up a matrix... you should be able to index a linear array based on a 2D matrix as long as you know the width of the matrix.

    ie:

    assumes base 0 matrix
    index = (X * MatrixWidth) + Y

    (0,0) -> picture index 0
    (0,1) -> picture index 1

    -Shickadance

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