Results 1 to 5 of 5

Thread: dim statements

  1. #1

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727

    Resolved dim statements

    hi,

    can someone tell me why
    VB Code:
    1. Dim myDir as DirectoryInfo = New DirectoryInfo(Server.MapPath(PATH_DEST))
    2. Dim fileInfos() as FileInfo = myDir.GetFiles("*.hta")
    works while
    VB Code:
    1. Dim myDir as DirectoryInfo
    2. Dim fileInfos() as FileInfo
    3.        
    4. myDir = New DirectoryInfo(Server.MapPath(PATH_DEST))
    5. fileInfos() = myDir.GetFiles("*.hta")
    not?

    getting crazy on this one...
    Last edited by wildcat_2000; Nov 26th, 2004 at 04:54 AM.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: dim statements

    myDir = New DirectoryInfo(Server.MapPath(PATH_DEST))
    fileInfos = myDir.GetFiles("*.hta")

  3. #3

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    thank you mendhak,

    my problem was if then i had to redefine new files, and you actually have to set to nothing the fileinfos object to do so.

    for instance:
    VB Code:
    1. Dim myDir As DirectoryInfo
    2. Dim fileInfos() As FileInfo
    3.        
    4. myDir = New DirectoryInfo(Server.MapPath(PATH_DEST))
    5. fileInfos() = myDir.GetFiles("*.hta")
    6.  
    7. 'do some stuff here
    8.  
    9. fileinfos = nothing
    10. fileInfos = myDir.GetFiles("*.mdb")
    11.  
    12. 'do some stuff here
    this works, but if you comment out the fileinfos = nothing statement it will generate an error.

    thank you, you showed me the way out,

    cheers,

    wc.
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by wildcat_2000


    thank you, you showed me the way out,
    I am the light, the truth... Sandpaper&trade;

  5. #5

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    lol
    When your car breaks down,
    close all windows and retry

    => please rate all users posts! <=

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