link

I'm having a public const string logpath & logfile; in my Form1

I'm trying to access it in my LoginForm, like this:

//Create a temp file
File.Create(Form1.Paths.logpath + comboBox1.Text + ".tmp");
// Tried to assign the value (in LoginForm) to logfile so that I can use it in Form3
Form1.Paths.logfile = Form1.Paths.logpath + comboBox1.Text + ".tmp"; // Not accepting

// I also tried this
string tmpfile = Form1.Paths.logpath + comboBox1.Text + ".tmp"; //tmpfile's value is ""


What I'm trying to do is:
  • On successful login a temp file of Username is created

  • Username is fetched from comboBox.text in "Login" form

  • Login formload event will check if comboBox.Items = filename

  • If yes then a simple messagebox.show will say "Another user is logged in, kindly wait". and will close the Login form so that two users should not login to edit the main file.

  • Form3 logout (hyperlink) click event should fetch the path so that logout can delete the temp file