Results 1 to 10 of 10

Thread: whats wrong with this short (5 line) code?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    Code:
        If Not Dir("c:\dimava.dat", vbNormal Or vbReadOnly Or vbHidden Or _
            vbSystem Or vbArchive) = "" Then
            Form1.Visible = True
        End If
    NXSupport - Your one-stop source for computer help

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    what are your trying to do
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    New Member
    Join Date
    Aug 2000
    Location
    Brazil
    Posts
    14
    ?????
    what do you wanna do?
    by Ramosf

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    for the record everty button post When that file is there I want the form to be visible so that I can see all the keys presses (the text box)
    NXSupport - Your one-stop source for computer help

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    it works this way.
    Dim MySize
    MySize = FileLen("c:\my documents\myfile.txt") ' Returns file length (bytes).

    If MySize = "" Then
    MsgBox "no file"
    Else
    MsgBox "FILE"
    End If
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    HeSaidJoe, you get an error if there's no file, and no file for 0-length files, so using dimivas sample:
    Code:
    on error resume next
    If ""<>Dir("c:\dimava.dat", vbNormal Or vbReadOnly Or vbHidden Or vbSystem Or vbArchive) = "" Then
        if not err then Form1.Visible = True
    End If
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    When you're using the Or operator on all the flag values (vbNormal, vbHidden and so on) you're actually adding them together.
    So the dir function will return an empty string if not all attributes are set on the file.

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I don't think that's the case Joacim, dir is for listing files, and it won't list for instance hidden files unless you turn that flag on, but the normal files will be listed
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Yes you're probably right. I'm just tired and confused.

    BTW Kedaman
    När kommer du över till Sverige nästa gång då?

  10. #10
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Err. I'm sorry?

    När kommer du över till Sverige nästa gång då

    I can speak dutch too!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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