Results 1 to 12 of 12

Thread: Please Help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130

    Wink Please Help

    ok I am trying to call all pictures at this location

    c:\tecmo\faces\"strtag".bmp
    how do I load the pic so if
    pic.tag = 15 then it loads c:\tecmo\faces\15.bmp
    and so on??


    i tried below and it didnt work
    Private Sub pitcher()
    Dim strTag As String
    strTag = PIC.Tag
    PIC = strTag & ".Bmp"


    End Sub
    thanks,
    Matt

  2. #2
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    Use the LoadPicture-Method.

    Set Pic = LoadPicture( strTag & ".Bmp" [,OptCode] )

    Hope this helps,
    Dennis.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    whats

    Set Pic = LoadPicture( strTag & ".Bmp" [,OptCode] )

    OPTCODE???
    thanks,
    Matt

  4. #4
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    [, OptCode] should just indicate that there's more possible...

    In general you just use the Path-Param.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    1 more thing here is my code now


    Private Sub pitcher()
    Dim strTag As String

    strTag = PIC.Tag
    Set PIC = LoadPicture(c:\tecmo\faces\strTag & ".Bmp")



    End Sub
    and I am getting a syntax error and expect list or seperater????

    thanks I am still learning
    MAtt

  6. #6
    Matthew Gates
    Guest
    [, OptCode] = Optional Code, you can use it or you don't have to.

    Here are your options that you can use beside the filename with the LoadPicture function.

    LoadPicture([FileName], [Size], [ColorDepth], [X], [Y]) As IPictureDisp

    Filename is required, all others are optional.

  7. #7
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    LoadPicture has several options:

    LoadPicture([FileName], [Size], [ColorDepth], [X], [Y]) As IPictureDisp

    I've bundled the rest...


    Code:
    Private Sub pitcher() 
    Dim strTag As String 
    
    strTag = PIC.Tag 
    Set PIC = LoadPicture(c:\tecmo\faces\strTag & ".Bmp") 
    
    End Sub

    This should work:

    Code:
    Private Sub pitcher()
       Dim strTag As String
    
       strTag = PIC.Tag
       Set PIC.Picture = LoadPicture("c:\tecmo\faces\" & strTag & ".Bmp")
    
    End Sub

    Dennis.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  8. #8
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255

    Angry

    I hate to write things somebody else wrote 5 minutes before
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  9. #9
    Hyperactive Member techman2553's Avatar
    Join Date
    Mar 2001
    Location
    <- To your left.
    Posts
    362
    The LoadPicture Command requires a String argument, the code you used need quotes around the path like this:

    Code:
    Private Sub pitcher() 
    Dim strTag As String 
    
    strTag = PIC.Tag 
    Set PIC = LoadPicture("c:\tecmo\faces\" & strTag & ".Bmp")
    This should work because you are directly assigning the tag number to a string variable. Keep in mind, if you had used the Str() function to convert the tag number to a string, it would have had a leading space:

    strTag = Str(PIC.Tag)

    strTag would equal " 15"

    To get around this, use the Format function:

    strTag = Format(PIC.Tag)

    strTag would equal "15"

    It doesn't matter for the code above, but just for future reference.
    ----------

  10. #10
    Matthew Gates
    Guest
    Try this:

    Code:
    Private Sub pitcher() 
        Dim strTag As String 
        strTag = PIC.Tag 
        Set PIC = LoadPicture("C:\tecmo\faces\" & strTag & ".bmp") 
    End Sub

  11. #11
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    Str() is the most useless function in vb I think...

    Doesn't anybody know CStr() ? It converts everything to a string without leading spaces... Always seeing Trim(Str(*blah*))
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    thanks guys it works

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