If you add 0, you can put this code right after...
List4.RemoveItem tmp(0) .. but that just gives me a type mismatch error :-/
Printable View
If you add 0, you can put this code right after...
List4.RemoveItem tmp(0) .. but that just gives me a type mismatch error :-/
It should be:
.RemoveItem method receives an Integer as a parameter. That Integer is the index of the item you'd like to remove.Code:List4.RemoveItem 0
Did that, but it still isnt working the way I'd like it to. Any way i can rewrite the last code i inputed (post 44) so that i can load one item also?
Hello.
So if my code works for 2 or more maybe you'll try to figur out how many files you selected before the procedure.
The way to do it is simply count the " characters in your string. If there are more than 2 it means you selected 2 or more files (as every file comes with "file.ext").The ascii character for " is Chr(31).
There are some examples on this forum about how to count letters in a string so please refer to them.
Best regards
That's not actually what i want to find out. I just want to change your code so it can accept 1 file at a time also :-/
VB Code:
Dim Counter As Integer Counter = 0 For j = 1 To Len(filename) Value = Right(Left(filename, i), 4) If Value = ".mp3" Then Counter = Counter + 1 End If Next j If Counter >= 2 Then For i = 2 To UBound(tmp) List1.AddItem tmp(i) Next i List1.AddItem tmp(1) Else List1.Additem filename End If
Did a homework for you. Does it work?
Edit: I'm sorry I forgot that the "" characters are only displayed in a combo box and are not the part of a string. If you are adding mp3 files the above code should work. If you want to add more extensions (like wav) you should place ther OR ".wav". Of course this wont work if file name consists of these strings - for example you want to add 1 file named michaeljackson.mp3.mp3.
What does "did a homework for you" mean?
Tried your code, doesnt load anything. :(
:cry: Hello. I'm very sorry I could not help although I tried hard. Please look at your previous code which loaded 2 files or more and look at my code from previous post. I think you should find the way to combine those two to make it working.
Regards :eek2: