Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. public class Account
  2. {
  3. public static List<Account> myAccountList = new List<Account>();
  4. public string Domain; //this is supposed to be google/skype/facebook
  5. public string Email;
  6. public string Username;
  7. public string Password;
  8.  
  9. public Account (string domain, string email, string username, string password)
  10. {
  11. Domain = domain;
  12. Email = email;
  13. Username = username;
  14. Password = password;
  15. myAccountList.Add(new Account(domain, email, username, password)); //constructor calls the new list instance
  16. }
  17. private static void SaveToFile()
  18. {
  19. System.IO.File.WriteAllLines(@accountdb.txt, myAccountList);
  20. }
  21. private static void ReadFromFile() // this is meant to be used as authentication in my main form, it isn't necessary right now..
  22. {
  23. System.IO.File.ReadAllLines(@accountdb.txt);
  24. }
  25. }
  26.  
  27. private void buttonSave_Click(object sender, EventArgs e)
  28. {
  29. string domain, email, username, password;
  30. domain = comboboxDomain.Text;
  31. email = textboxEmail.Text;
  32. username = textboxUsername.Text;
  33. password = textboxPassword.Text;
  34. //Checking for correct EMAIL
  35.  
  36. if (!textboxEmail.Text.Contains("@") && (!textboxEmail.Text.Contains(".")))
  37. {
  38. MessageBox.Show("Invalid Email Format");
  39. }
  40. else
  41. {
  42. Account account = new Account(domain, email, username, password);
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement