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!
Question
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Mike GoldRank #50 · 30.6K pointsPosted Oct 16, 2007, 9:10 AM EDT
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
//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
Michael20 pointsPosted Oct 16, 2007, 9:23 AM EDT
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?
Mike GoldRank #50 · 30.6K pointsPosted Oct 16, 2007, 8:13 PM EDT
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,