|
-
Sep 27th, 2001, 11:22 AM
#1
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.
-
Sep 27th, 2001, 11:24 AM
#2
text1.text = list1.listindex (not selected index)
-
Sep 27th, 2001, 11:25 AM
#3
k thx i know it wasn't selectedindex, just using it as an example. thx.
-
Sep 27th, 2001, 12:10 PM
#4
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.
-
Sep 27th, 2001, 12:14 PM
#5
-
Sep 27th, 2001, 12:22 PM
#6
Try make your variable a a Long
Dim a As Long
a = 001
a = a + 1 would result in a equaling 002
-
Sep 27th, 2001, 12:25 PM
#7
nah, still didn't work as long makes a = 1 even though i put it in quotes
-
Sep 27th, 2001, 12:27 PM
#8
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.
-
Sep 27th, 2001, 12:27 PM
#9
PS: You are dealing with a number, so DONT put your variable in quotes!!
-
Sep 27th, 2001, 12:28 PM
#10
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
-
Sep 27th, 2001, 12:29 PM
#11
when i don't put the number in quotes it sets it back to 1 instead of 001
-
Sep 27th, 2001, 12:30 PM
#12
cant i put a = 1001 then somehow take out the 1 when its copying the file?
-
Sep 27th, 2001, 12:33 PM
#13
should i make another topic? cause it has nothn to do wit a listbox..
-
Sep 27th, 2001, 12:59 PM
#14
New Member
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
-
Sep 27th, 2001, 01:06 PM
#15
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|