Skip to content

Question

Michael

Asked Oct 16, 2007, 8:18 AM EDT3 answers
Share
LinkedInX
Hello, I am trying to display items from a search location the user has pick. And I am not quite sure on how one would store and then display the browsed area?

I hope you understand what I am trying to do.

Thanks for your help!

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Mike Gold
    0

    you probably want to scrape the info directly from the web request:

    Here is the code to get data into a string from a url request

    Java
    //Create a HttpWebRequest object for the server search URL
    HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(String.Format("{0}{1}&d=e", ServerURL, stock));
    // retrieve the response web page we want to scrape and put it into a string
    HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse();
    StreamReader strm = new StreamReader(webresp.GetResponseStream(), Encoding.ASCII);
    string res = strm.ReadToEnd();

    Afterword, if you want to display it as html, use the WebBrowser Control, otherwise you can use either a rich text box or a multiline textbox

    0
  • 0
    Kind of but im just working with C# and the GUI I figured it out I used

                foreach (string mp3 in Directory.GetFiles(musicPath.Text))
                    this.listBox1.Items.Add(mp3);

    to get the list of what was in a folder.

    But now I would like to make it so only the names of the files that are in said folder to show up. Not that whole path just the name. Is that possible?
    0
  • Mike Gold
    0

     Ahh...Now its much more clear what you are trying to do.

    Use
    string mySong = System.IO.Path.GetFileName(mp3). 

    If you want to drop the extension, use

    string mySong = System.IO.GetFileNameWithoutExtension(mp3);

    Best,

    0