Advertisement
Guest User

Paste 1

a guest
Jul 19th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace RememberMyPasswords
  12. {
  13. public partial class Form1 : Form
  14. {
  15. string removewhat;
  16. List<string> names = new List<string>();
  17. List<string> passwords = new List<string>();
  18. List<string> emails = new List<string>();
  19. List<string> websites = new List<string>();
  20.  
  21. public Form1()
  22. {
  23. InitializeComponent();
  24. }
  25.  
  26. //Load
  27. private void Form1_Load
  28. (object sender, EventArgs e)
  29. {
  30. }
  31.  
  32. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  33. {
  34. if(checkBox1.Checked)
  35. {
  36. treeView1.Sort();
  37. }
  38. else if(checkBox1.Checked == false)
  39. {
  40.  
  41. }
  42. }
  43.  
  44. public void add()
  45. {
  46.  
  47. TreeView t = new TreeView();
  48. t = treeView1;
  49. names.Add(textBox1.Text);
  50. passwords.Add(textBox2.Text);
  51. emails.Add(textBox3.Text);
  52. websites.Add(textBox4.Text);
  53.  
  54. string addedname = textBox1.Text;
  55. string addedpass = textBox2.Text;
  56. string addedemail = textBox3.Text;
  57. string addedwebsite = textBox4.Text;
  58. string nodename = textBox5.Text;
  59. int treecount = 0;
  60.  
  61. removewhat = nodename;
  62.  
  63. t.Nodes.Add(nodename);
  64. t.Nodes[treecount].Nodes.Add($"Username: {addedname?? "Empty"}");
  65. t.Nodes[treecount].Nodes.Add($"Password: {addedpass?? "Empty"}");
  66. t.Nodes[treecount].Nodes.Add($"Email: {addedemail?? "Empty"}");
  67. t.Nodes[treecount].Nodes.Add($"Website: {addedwebsite ?? "Empty"}");
  68.  
  69. treecount += 1;
  70.  
  71. removewhat = null;
  72. nodename = null;
  73. addedname = null;
  74. addedpass = null;
  75. addedemail = null;
  76. addedwebsite = null;
  77.  
  78. textBox3.Clear();
  79. textBox4.Clear();
  80. textBox1.Clear();
  81. textBox2.Clear();
  82. textBox5.Clear();
  83. }
  84.  
  85. private void button1_Click_1(object sender, EventArgs e)
  86. {
  87. add();
  88. }
  89.  
  90. private void treeView1_AfterSelect_1
  91. (object sender, TreeViewEventArgs e)
  92. {
  93. var requestresponse = MessageBox.Show($"Are you sure you want to remove \"{treeView1.SelectedNode}\"", "", MessageBoxButtons.YesNo);
  94. if (requestresponse.ToString() == "Yes")
  95. {
  96. treeView1.Nodes.Remove(treeView1.SelectedNode);
  97. }
  98. else { };
  99. }
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement