Results 1 to 3 of 3

Thread: [RESOLVED] Have I dropped a file or a folder?

  1. #1

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Resolved [RESOLVED] Have I dropped a file or a folder?

    I have a question similar to this one but I thought I'd start a new thread to avoid confusion.
    After I have dragged and dropped a number of files into a listview I store their names in an array like this:
    VB Code:
    1. i = 1
    2.     For Each Files In Data.Files
    3.         Array(i) = Files
    4.         i = i + 1
    5.     Next
    Now, my question is how do you know if Files is a file or a directory?
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Have I dropped a file or a folder?

    VB Code:
    1. Private Function IsDirectory(ByVal sPath As String) As Boolean
    2.     IsDirectory = GetAttr(sPath) And vbDirectory
    3. End Sub

  3. #3

    Thread Starter
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: Have I dropped a file or a folder?

    Thanks, I was using similar code:
    VB Code:
    1. Private Function IsDirectory(ByVal sPath As String) As Boolean
    2.     i = GetAttr(sPath)
    3.     If i And vbDirectory <>0 Then
    4.     '... etc
    but I had declared i as integer, that's why it didn't work.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

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