What code would I need to update a label to "Ok" or "Do not use" depending on whether the value in a text file is 1 or 2?
Also, when going from one form to another is there a part of the code which allows you to for example, update label text and whether buttons are enabled?
Loading
AlanPosted Jun 15, 2007, 10:42 AM
StreamReader sr = new StreamReader("myFile.txt");
int number = int.Parse(sr.ReadLine());
sr.Close();
if (number == 1)
label1.Text = "Ok";
else if (number == 2)
label1.Text = "Do not use";
On the second part, you could create an eventhandler for the form's Activate or Deactivate events and put some stuff in there.