Results 1 to 9 of 9

Thread: help with Dir, Drive and FileList

  1. #1

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    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:
    1. '//////// SELECT DRIVE LETTER FROM LOCAL HARD DRIVE - COMPANY BIOS /////////////////
    2. Private Sub Dir1_Change()
    3.     On Error Resume Next: File1.Path = Dir1.Path
    4.     '////// reset values to nothing as soon as you change directories
    5.     picBioImage.Picture = LoadPicture
    6.     txtfile1.Text = ""
    7. End Sub
    8.  
    9.     '//////////// SELECT FOLDER FROM DRIVE //////////////////////
    10. Private Sub Drive1_Change()
    11.     On Error Resume Next: Dir1.Path = Drive1.Drive
    12. End Sub
    13.  
    14.     '/////////// PUT FILE INTO TEXT BOX
    15. Private Sub File1_Click()
    16.     Dim txtPath$
    17.     txtPath$ = Dir1.Path
    18.     If Mid(txtPath$, Len(txtPath$), 1) = "\" Then
    19.         txtfile1.Text = Dir1.Path & File1.FileName
    20.     Else
    21.         txtfile1.Text = File1.FileName
    22.     End If
    23.    
    24.    picBioImage.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName)
    25.        
    26. End Sub
    He who never made a mistake never made a discovery?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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.

  3. #3

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    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 ?
    He who never made a mistake never made a discovery?

  4. #4
    Junior Member
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    30

    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...

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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.

  6. #6

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    Re: help with Dir, Drive and FileList

    Ok, all the images have .jpg extensions. Here's the form.
    He who never made a mistake never made a discovery?

  7. #7

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    Re: help with Dir, Drive and FileList

    Hack,

    I just did what you suggested and it worked.
    I don't understand it.

    But I am glad it works!
    He who never made a mistake never made a discovery?

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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.

    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.

  9. #9

    Thread Starter
    Fanatic Member Navarone's Avatar
    Join Date
    Jun 2003
    Location
    Akron, Ohio USA
    Posts
    740

    Re: help with Dir, Drive and FileList

    Man I really feel like a dope!
    I just checked my clearAll routine and sure enough, I reset the pattern.

    Thanks for all your help
    He who never made a mistake never made a discovery?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width