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.
Printable View
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.
text1.text = list1.listindex (not selected index)
k thx i know it wasn't selectedindex, just using it as an example. thx.
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.
anyone??
Try make your variable a a Long
Dim a As Long
a = 001
a = a + 1 would result in a equaling 002
nah, still didn't work as long makes a = 1 even though i put it in quotes
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.
PS: You are dealing with a number, so DONT put your variable in quotes!!
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
when i don't put the number in quotes it sets it back to 1 instead of 001
cant i put a = 1001 then somehow take out the 1 when its copying the file?
should i make another topic? cause it has nothn to do wit a listbox..
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
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