In my Form1 Event, not everything is completed. Only the first line is actually executed.
private void Form1_Load(object sender, EventArgs e)
{
//Save the currentUser text document's contents into the currentUser string
System.IO.StreamReader file = new System.IO.StreamReader("C\\Users\\WoopyCat\\AppData\\Roaming\\.minecraft\\currentUser.txt");
currentUser = file.ReadLine();
//Save the currentUser into the textbox
TBcurrentUser.Text = "The current user is " + currentUser + ".";
//Set the default text for the textbox
TBchangeTo.Text = "Whose Minecraft folder are you switching to?";
//Add the default two items to the listbox
LBfiles.Items.Add("Minecraft folders:" + Environment.NewLine);
LBfiles.Items.Add("---------------------------------------------------------------------------------------------------------------------------");
//Create the directory if it doesn't exist
if (!Directory.Exists("C:\\Users\\WoopyCat\\AppData\\Roaming\\" + folderName))
{
Directory.CreateDirectory("C:\\Users\\WoopyCat\\AppData\\Roaming\\" + folderName);
}
//Set the default instructions in the textbox
TBinstructions.Text = instructions;
//Add each directory to the listbox
foreach (string value in Directory.GetDirectories("C:\\Users\\WoopyCat\\AppData\\Roaming\\" + folderName))
{
//Remove the file location from the string
each = value.Replace("C:\\Users\\WoopyCat\\AppData\\Roaming\\.MCSwitcher\\", "");
LBfiles.Items.Add(each + Environment.NewLine);
}
}
Nothing happens when the form loads. If I add a first line, then it actually occurs. Like if I call a messagebox as the first line in this event, it happens. But nothing in this code does.