title: login directly from .txt file in winform c#
body: <p>I am working on winform project. In my scene, I am saving <code>username</code> and <code>password</code> of user into <code>.txt</code> file named <code>credentials.txt</code> . now I want that, when I open my application first time, that means <code>credentials.txt</code> is blank. I have to enter username and password in login form. But when I close application and <code>login agian</code>, my <code>login form</code> should read username and password from .txt file and directly login with that. Not opening <code>login form</code>.</p>
  
  <p>I have saved username and password in .txt file. But dont know how to perform next step.</p>
  
  <p>My code for saving credentials in .txt file:</p>
  
  <pre><code>private void btnLogin_Click(object sender, EventArgs e)
  {
      try
      {
          string Log_API = "http://api.retailbutton.co/WS/Service.php?Service=employeeLogin";
          if (LoginUser(Log_API))
          {
              logIn_Status = "true";
              GlolbalUtil.LogIn_Status = logIn_Status;
              this.Hide();
  
              string credentialPath = Environment.CurrentDirectory + "\\credentials\\credentials.txt";
              using (StreamWriter writer = new StreamWriter(credentialPath, true))
              {
                  writer.WriteLine("UserName :" + txtUsername.Text + Environment.NewLine + "Password :" + txtPassword.Text);
              }
  
              frmDash frmDash = new frmDash();
              frmDash.Owner = this;
              frmDash.Show();
              txtUsername.Text = "";
              txtPassword.Text = "";
              //GlolbalUtil.accept_status = "1";
          }
          else
          {
              MessageBox.Show("Please Check Username and password");
          }
      }
      ...
  </code></pre>