I am trying to use a text file to save the language my program needs to use. And saving the language in the text file goes fine. Also retrieving the language from it goes fine. But using the retrieved string to catch a language from it won't succeed. And somehow it won't work no matter what I try.
This is my code:
This is my code:
Code:
public static string language = "";
private void ExtensionSearcher_Load(object sender, EventArgs e)
{
try
{
if (File.Exists("setup.txt"))
{
StreamReader sr = new StreamReader("setup.txt");
language = sr.ReadToEnd();
MessageBox.Show(language);
switch (language)
{
case "Nederlands":
lblSearchExt.Text = "Zoek op extensie";
lblSearchType.Text = "Zoek op type";
lblSearchProgram.Text = "Zoek op programma";
lblExtList.Text = "Extensies";
lblTypeList.Text = "Types";
lblProgramList.Text = "Programma's";
break;
case "English":
lblSearchExt.Text = "Search by extension";
lblSearchType.Text = "Search by type";
lblSearchProgram.Text = "Search by program";
lblExtList.Text = "Extensions";
lblTypeList.Text = "Types";
lblProgramList.Text = "Programs";
break;
}
}
Comment