1

I'm building a word search application for my term 1 University project, I basically have a Windows Form Application which uses an array to populate a list box when a user inputs text into the "Add" field. I also have included the option to remove added items to the list but wanted to create a question box to ask the user if they wanted to delete item {0} in the array.

I have been experimenting for a good hour or so and could not find anything on the net to solve my problem. Below is my code snippet to the applicable section...

   //Clear the contents of the selected item
    private void deleteBtn_Click(object sender, EventArgs e)
    {
        string findMyWord = findLst.Text;

        if (MessageBox.Show(string.Format("You are trying to clear the contents of {0}, do you wish to proceed?", findMyWord, "Delete the items contents?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) == DialogResult.Yes)
        {
            findLst.Items.Remove(findLst.SelectedItem);
        }  

Thanks in advance.

4

0 回答 0