Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

asp.net problem

Options
  • 30-05-2006 2:01pm
    #1
    Registered Users Posts: 77 ✭✭


    Hi folks, I'm using web matrix at the moment and I would like to display the files from a particular folder in a listbox, would anyone be able to help me???


Comments

  • Registered Users Posts: 872 ✭✭✭grahamor


    what do you mean, a particular folder in the website or on your desktop ?

    You should probably write an xml page that has the name of the file and the reference to where it is and then bind the xml file to the listbox control.

    I am familiar doing this with databases but not any other way

    edit: you should download visual web developer 2005 aswell (it's free), web matrix is discontinued and shi*te because there is no predicitive code writing (intellisense) which will save you so much time


  • Registered Users Posts: 683 ✭✭✭Gosh


    This should do .. just call it for each folder (with the full path name)
    Sub BuildFileList(strFolder)
       Set oFolder = oFS.getFolder(strFolder)
       Echo("<SELECT NAME=filelist>")
       For Each FileName in oFolder.Files
          Echo("<OPTION VALUE=" & Chr(34) & FileName.Name _
          & Chr(34) & ">" & FileName.Name & "</OPTION>")
       Next
       Echo ("</SELECT>")
       Set oFolder = Nothing
    End Sub
    


  • Registered Users Posts: 77 ✭✭peteym


    The folder is located on a shared drive - trying to download microsoft web developer thingy but for some reason won't install for me.

    Thanks for your help guys


  • Closed Accounts Posts: 140 ✭✭Sneaky_Russian


    in the page load, you could do something like so to list the files in the current directory
    if(!IsPostBack)
        foreach(string filename in System.IO.Directory.GetFiles(Server.MapPath("~/")))
            ListBox1.Items.Add(new ListItem(filename));
    
    


Advertisement