How do you pick a random line from an embedded text file?
When I run the program it crashes and gives me this error (Illegal characters in path) On this line ( String[] randFirst = File.ReadAllLines(Separis_Fantasy_Tools_PE.Properties.Resources.fnames); )
This is what I have.
private void btnRandom_Click(object sender, EventArgs e)
{
String nFirstName;
String nLastName;
Random fname = new Random();
Random lname = new Random();
String[] randFirst = File.ReadAllLines(Separis_Fantasy_Tools_PE.Properties.Resources.fnames);
nFirstName = randFirst[fname.Next(randFirst.Length)];
String[] randLast = File.ReadAllLines(Separis_Fantasy_Tools_PE.Properties.Resources.lnames);
nLastName = randLast[lname.Next(randLast.Length)];
txtCharacterName.Text = nFirstName + " " + nLastName;
return;
}