private void button1_Click(object sender, EventArgs e) { if (maskedTextBox1.Text.Length < 1) { return; } int addr = Utilities.ConvertToInt(maskedTextBox1.Text); if (addr > 65535) { System.Windows.Forms.MessageBox.Show("The address is not within 0 to 65535!", "Invalid input", MessageBoxButtons.OK); return; } foreach (Monitor.WatchVariable wv in monitor.watchVariableList) { if (wv.Address == addr) { return; } } monitor.AddWatchVariable(addr, textBox1.Text); dataGridView1.Refresh(); }