private void buttonAdd_Click(object sender, EventArgs e) { if (ValidateInput()) { if (serverPtr2 == null) { MessageBox.Show("You didn't started server"); return; } HashTableValues htv = new HashTableValues(); htv.valid = true; htv.ip = textBox2.Text; htv.locationID = textBox3.Text; // Its valid, update Hashtable, update sender IP, and clear texboxes HashtableAndDatabaseClass.AddToHashTable(textBox1.Text, htv); serverPtr2.updateSender(textBox2.Text); // Update setting file Properties.Settings.Default.FormManualMAC = textBox1.Text; Properties.Settings.Default.FormManualIP = textBox2.Text; Properties.Settings.Default.FormManualLocation = textBox3.Text; Properties.Settings.Default.Save(); // Make it persistant // Clear, in case u want to add new device textBox2.Text = ""; textBox1.Text = ""; textBox3.Text = ""; } }