no, way off. I am sorry.
I have a filelistbox. That is directed to a directory. What I need is a way to have it go to the first name and copy it to the textbox. Then go to the next filename and copy it to the text box without file extention. And so one until no filenames exist. Has nothing to do with a combo box. Again I am sorry. Can you help.
Main Topics
Browse All Topics





by: kwalkPosted on 2003-07-21 at 20:37:56ID: 8973148
Are you using a textbox or a combobox? Are you trying to fill the list of a combobox?
How are the file names being stored? Are we looping through an array that you have already filled? Or a Dir$ function?
Once we have those specifics, I can answer that better.
But you'll basically be looping something like this (I'm guessing you're adding items to a combobox?):
Dim strFileName As String
Dim x as long
Dim strTemp as string
Dim lngPosition as long
For x = 1 to Ubound(strArray) (not sure what you're looping, but I'll assume an array)
strFileName = strArray(x)
'locate position of period (from right)
lngPosition = InStrRev(strFileName, ".")
' Check to see if it qualifies as an extension (assuming extension will always be 3 chars long)
If Len(strFileName) - lngPosition = 3 Then
strTemp = Left$(strFileName, lngPosition - 1)
Else
' not sure what to do with this - it doesn't have the "usual" extension
strTemp = strFileName
End If
combobox.additem strTemp
Next x