Ive searched high and low for this but cant find it.
Im trying to make a list with names from a specific folder that holds a lot of text files. I want the list to be clickable so let's say if it show a name like "Name1" and i click it i want it to get me to a new form with a textbox showing the information from the textfile "Name1".
I hope ive explained my problem well enough so someone can help me and ill be very grateful for any help i can get!
This is not a code write-my-code site, so I will only give you hints:
System.IO
namespace to both forms string fileName;
public Form2(string fn)
{
InitializeComponent();
fileName = fn;
}
ListBox
to the 1st FormTextBox
to the 2nd FormDirectory.GetFiles()
Items
of the ListBox
use ListBox.AddRange()
methodListBox.SelectedItem
in the ListBox.SelectedIndexChanged
eventif (listBox1.SelectedItems.Count > 0)..
ToString()
on the Item
new Form2(filename)
and Show()
itFile.ReadAllText
and assign the result to textBox1.Text
Please look up all the methods on MSDN to find the right format and examples of their use!