help with Dir, Drive and FileList
I am using the following code to search for "*.jpg", a property I set for the pattern in the fileListBox. I have a add button that allows me to add the content of the FileListBox. After I add the image name to my db, I clearAll, and now I am ready to add another image. But When I navigate through the dir, I can nolonger get any jpg images to appear in the FileListBox. Is there something wrong with my code?
VB Code:
'//////// SELECT DRIVE LETTER FROM LOCAL HARD DRIVE - COMPANY BIOS /////////////////
Private Sub Dir1_Change()
On Error Resume Next: File1.Path = Dir1.Path
'////// reset values to nothing as soon as you change directories
picBioImage.Picture = LoadPicture
txtfile1.Text = ""
End Sub
'//////////// SELECT FOLDER FROM DRIVE //////////////////////
Private Sub Drive1_Change()
On Error Resume Next: Dir1.Path = Drive1.Drive
End Sub
'/////////// PUT FILE INTO TEXT BOX
Private Sub File1_Click()
Dim txtPath$
txtPath$ = Dir1.Path
If Mid(txtPath$, Len(txtPath$), 1) = "\" Then
txtfile1.Text = Dir1.Path & File1.FileName
Else
txtfile1.Text = File1.FileName
End If
picBioImage.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName)
End Sub
Re: help with Dir, Drive and FileList
I dumped your code into a new project, and played with it for 10 minutes or more, and I had no problems with it. I even took out all of your error traps to see if something would blow up, but I went through all kinds of folders selection .jpg files left and right and no problem.
Try taking out the On Error statements in your project and then run it to see if you can get an error that might give you some point of reference.
Re: help with Dir, Drive and FileList
I just did that, and it didn't blow up anywhere. When I am done adding and clear all, I set the Drive,Dir, and FlieListBox visible property to false, and I use a check box, to make them reappear. So the check box is setting the visible property true or false. Could that have anything to do with not showing up. I'm really stumped. Would I need to reset the File1.pattern ? :)
Re: help with Dir, Drive and FileList
No, your code looks fine. Can you give us the whole form file ?
Check if your pictures do not have the extension .JPEG
occasionally, this happens...
Re: help with Dir, Drive and FileList
Quote:
Originally Posted by Navarone
I just did that, and it didn't blow up anywhere. When I am done adding and clear all, I set the Drive,Dir, and FlieListBox visible property to false, and I use a check box, to make them reappear. So the check box is setting the visible property true or false. Could that have anything to do with not showing up. I'm really stumped. Would I need to reset the File1.pattern ? :)
I can't see how toggling the visible property of these controls would affect, either postively or negatively, the pre-established pattern. After you clear everything, pop up a message box to display File1.Pattern to see what that is after you have done a clear all.
If it somehow got changed, then in your checkbox that toggles them back to visible, reset the pattern and see how that works.
Re: help with Dir, Drive and FileList
Ok, all the images have .jpg extensions. Here's the form.
Re: help with Dir, Drive and FileList
Hack,
I just did what you suggested and it worked. :)
I don't understand it. :confused:
But I am glad it works!
Re: help with Dir, Drive and FileList
Quote:
Originally Posted by Navarone
Hack,
I just did what you suggested and it worked. :)
I don't understand it. :confused:
But I am glad it works!
Cool. BTW: I downloaded your form and played with it for a while. Since I don't have the Db you are using, I commented all the save/connection stuff out and played just the the File/Drive/Dir controls. They all work just fine.
I conclude then, that somewhere either in your clear all routine or your save routine, the pattern is getting disrupted.
Re: help with Dir, Drive and FileList
Man I really feel like a dope! :lol:
I just checked my clearAll routine and sure enough, I reset the pattern.
Thanks for all your help :)