Results 1 to 15 of 15

Thread: listbox question plz help!!!

  1. #1
    InternalError
    Guest

    listbox question plz help!!!

    hi, i have a listbox and a textbox, when the user clicks on an item in the listbox, the textbox will display the index number of the item the user clicked on in the listbox. how can i do this?

    ie:
    text1.text = list1.selectedindex

    hehe.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    text1.text = list1.listindex (not selected index)

  3. #3
    InternalError
    Guest
    k thx i know it wasn't selectedindex, just using it as an example. thx.

  4. #4
    InternalError
    Guest
    another problem. I'm making the program rename files automatically. the files are in the a:\ drive and they go in sequence. IE: abc-001s.jpg, abc-002s.jpg, abc-003s.jpg etc.

    So, I have this code:

    dim a as string
    a = "001"

    do:
    filecopy "A:\abc" & a & "s.jpg", "text1.text" & ".jpg"
    a = a + 001
    ' this adds 001 to a, which SHOULD HAVE made a = 002, 003, etc.
    'but math doesn't work dat way...any suggestions??
    i know i suck at programming lol.

  5. #5
    InternalError
    Guest
    anyone??

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Try make your variable a a Long

    Dim a As Long

    a = 001

    a = a + 1 would result in a equaling 002

  7. #7
    InternalError
    Guest
    nah, still didn't work as long makes a = 1 even though i put it in quotes

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Yes, you are right. That would happen. Sorry 'bout that.

    Two choices:

    1. Have your file names be abc1, abc2, etc

    2. Set a = 100 rather than 001. This will incretment a as 101, 102, 103, etc.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    PS: You are dealing with a number, so DONT put your variable in quotes!!

  10. #10
    InternalError
    Guest
    lol, this program is made to save time, but u see, i don't name the original files, they are from a digital camera and the camera automatically names it that...damn i cant believe this shiz!! lol

  11. #11
    InternalError
    Guest
    when i don't put the number in quotes it sets it back to 1 instead of 001

  12. #12
    InternalError
    Guest
    cant i put a = 1001 then somehow take out the 1 when its copying the file?

  13. #13
    InternalError
    Guest
    should i make another topic? cause it has nothn to do wit a listbox..

  14. #14
    New Member
    Join Date
    Dec 2000
    Location
    Brussels (Belgium)
    Posts
    11
    Just use the FORMAT function.
    i.e.:

    Private Sub Form_Load()
    Dim a As Integer

    For a = 1 To 10
    Debug.Print "A:\abc" & Format(a, "000") & "s.jpg"
    Next a
    End
    End Sub

  15. #15
    New Member
    Join Date
    Dec 2000
    Location
    Brussels (Belgium)
    Posts
    11
    Just use the FORMAT function.
    i.e.:

    Private Sub Form_Load()
    Dim a As Integer

    For a = 1 To 10
    Debug.Print "A:\abc" & Format(a, "000") & "s.jpg"
    Next a
    End
    End Sub

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