Display same message twice and thrice using listView
<p>I am working in a listview where I am trying to add role in it.
I have validation method that prevent the listview to have duplicate role.
The problem is it throws same message twice when I select another list item of listView
and it throws same message thrice when i select the scrollbar of list View. I think 
the using the listView.BeginEdit() in wrong way. Please ! help me to sort this problem</p>

<p>Code :</p>

<pre><code> private void AddDefaultRoles()
    {
        ListViewItem lvi = new ListViewItem("Reader");
        listViewRoles.Items.Add(lvi);

        lvi = new ListViewItem("Writer");
        listViewRoles.Items.Add(lvi);

        lvi = new ListViewItem("Administrator");
        listViewRoles.Items.Add(lvi);

        lvi = new ListViewItem("Delete");
        listViewRoles.Items.Add(lvi);

        lvi = new ListViewItem("Admin");
        listViewRoles.Items.Add(lvi);

        lvi = new ListViewItem("Contributor");
        listViewRoles.Items.Add(lvi);

        lvi = new ListViewItem("Designer");
        listViewRoles.Items.Add(lvi);
    }

    private void button1_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(textBox1.Text))
            textBox1.Text = "New Role";

        ListViewItem lvi = new ListViewItem(textBox1.Text);
        listViewRoles.Items.Add(lvi);

        lvi.Selected = true;
        lvi.BeginEdit();
    }


    private void listViewRoles_AfterLabelEdit(object sender, LabelEditEventArgs e)
    {
        ListViewItem lvi = listViewRoles.Items[e.Item];
        string newName = e.Label;
        if (newName == null)
            newName = lvi.Text;

        if (!ValidateRoleName(newName, e.Item))
        {
            lvi.BeginEdit();
            return;
        }
    }

    private void listViewRoles_BeforeLabelEdit(object sender, LabelEditEventArgs e)
    {

    }

    private bool ValidateRoleName(string name, int itemIndex)
    {
        const bool validName = true;
        if ((string.IsNullOrEmpty(name.Trim()))) //empty name
        {
            MessageBox.Show(this, "empty role name", "Rename failed");
            return !validName;
        }
        if (NameExists(name, itemIndex)) //name already exists
        {
            MessageBox.Show(this, "already exists", "Rename failed");
            return !validName;
        }

        return validName;
    }

    private bool NameExists(string newName, int itemIndex)
    {
        const bool nameExists = true;

        for (int i = 0; i &lt; listViewRoles.Items.Count; ++i)
        {
            if (itemIndex == i)
                continue;
            if (string.Compare(listViewRoles.Items[i].Text.TrimEnd(), newName.TrimEnd(), true) == 0)
            {
                return nameExists;
            }
        }
        return !nameExists;
    }
</code></pre>
