Hi all,
Im want to create a program for myself which will search my directories for ebooks and let me select the one i want to read. So for instance my first form has a button for C# Books, I want that then to produce a list of books found on my computer and let me pick one to read.
I know a way i can do this using oledb and msaccess and having a link field in the table. However the purpose is I do not wish to do this every time I attain a new book.
So far my snippets is as follow:
// Button to display all java booksprivate void button2_Click(object sender, EventArgs e) { listBox1.Items.Clear(); string[] book = Directory.GetFiles(@"C:\Books\JAVA", "*.*", SearchOption.AllDirectories); foreach (string b in book) { string filePath = Path.GetFullPath(b); string entry = Path.GetFileName(b); listBox1.Items.Add(entry); } }// Button to open fileprivate void button9_Click(object sender, EventArgs e) { string file = listBox1.SelectedItem.ToString(); System.Diagnostics.Process.Start(file); }So currently I can get the books in that particular folder to show, however I can not open the file unless I am displaying the path name which I want to avoid if possible.If anyone has any suggestion, would appreciate it very much.Cheers Guys
// Button to display all java books
private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
string[] book = Directory.GetFiles(@"C:\Books\JAVA", "*.*", SearchOption.AllDirectories);
foreach (string b in book)
string filePath = Path.GetFullPath(b);
string entry = Path.GetFileName(b);
listBox1.Items.Add(entry);
}
// Button to open file
private void button9_Click(object sender, EventArgs e)
string file = listBox1.SelectedItem.ToString();
System.Diagnostics.Process.Start(file);
So currently I can get the books in that particular folder to show, however I can not open the file unless I am displaying the path name which I want to avoid if possible.
So currently I can get the books in that particular folder to show, however I can not open the file unless I
If anyone has any suggestion, would appreciate it very much.
Cheers Guys