Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace RememberMyPasswords
- {
- public partial class Form1 : Form
- {
- string removewhat;
- List<string> names = new List<string>();
- List<string> passwords = new List<string>();
- List<string> emails = new List<string>();
- List<string> websites = new List<string>();
- public Form1()
- {
- InitializeComponent();
- }
- //Load
- private void Form1_Load
- (object sender, EventArgs e)
- {
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- if(checkBox1.Checked)
- {
- treeView1.Sort();
- }
- else if(checkBox1.Checked == false)
- {
- }
- }
- public void add()
- {
- TreeView t = new TreeView();
- t = treeView1;
- names.Add(textBox1.Text);
- passwords.Add(textBox2.Text);
- emails.Add(textBox3.Text);
- websites.Add(textBox4.Text);
- string addedname = textBox1.Text;
- string addedpass = textBox2.Text;
- string addedemail = textBox3.Text;
- string addedwebsite = textBox4.Text;
- string nodename = textBox5.Text;
- int treecount = 0;
- removewhat = nodename;
- t.Nodes.Add(nodename);
- t.Nodes[treecount].Nodes.Add($"Username: {addedname?? "Empty"}");
- t.Nodes[treecount].Nodes.Add($"Password: {addedpass?? "Empty"}");
- t.Nodes[treecount].Nodes.Add($"Email: {addedemail?? "Empty"}");
- t.Nodes[treecount].Nodes.Add($"Website: {addedwebsite ?? "Empty"}");
- treecount += 1;
- removewhat = null;
- nodename = null;
- addedname = null;
- addedpass = null;
- addedemail = null;
- addedwebsite = null;
- textBox3.Clear();
- textBox4.Clear();
- textBox1.Clear();
- textBox2.Clear();
- textBox5.Clear();
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- add();
- }
- private void treeView1_AfterSelect_1
- (object sender, TreeViewEventArgs e)
- {
- var requestresponse = MessageBox.Show($"Are you sure you want to remove \"{treeView1.SelectedNode}\"", "", MessageBoxButtons.YesNo);
- if (requestresponse.ToString() == "Yes")
- {
- treeView1.Nodes.Remove(treeView1.SelectedNode);
- }
- else { };
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement