Пример #1
0
        public void DeleteName()
        {
            int index = gridData.CurrentRowIndex;

            if (index < 0 || index >= table.Rows.Count)
            {
                return;
            }

            string ID = table.Rows[index].ItemArray[0].ToString();

            //Do not delete the Unknown ID
            int id = Convert.ToInt32(ID);

            if (id <= 1)
            {
                return;
            }

            //Ask for confirmation
            if (MessageBox.Show("Are you sure?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes) == false)
            {
                return;
            }

            //Now can delete anything
            aioDb.DeleteName(ID, subInfoType);
        }