private void button2_Click(object sender, EventArgs e) { if (!(this.CurrentState.currentPolicyInfo.ileg.Contains(textBox1.Text))) { this.CurrentState.currentPolicyInfo.ileg.Add(textBox1.Text); // this.myConnection.UpdatePolicyParams(this.CurrentState.myForum, this.CurrentState.currentPolicyInfo.minword, this.CurrentState.currentPolicyInfo.maxmoth, this.CurrentState.currentPolicyInfo.ileg); List <String> ans = CurrentState.currentPolicyInfo.ileg.ToList <String>(); myConnection.UpdatePolicyParams(CurrentState.myForum, CurrentState.currentPolicyInfo.minword, CurrentState.currentPolicyInfo.maxmoth, CurrentState.currentPolicyInfo.ileg.ToList <String>()); this.CurrentState.currentPolicyInfo = myConnection.GetPolicyParam(this.CurrentState.myForum); for (int i = 0; i < this.CurrentState.currentPolicyInfo.ileg.Count; i++) { listBox2.Items.Add(this.CurrentState.currentPolicyInfo.ileg.ElementAt(i)); } } else { MessageBox.Show("המילה המוזנת קיימת כבר"); } }