Exemplo n.º 1
0
        /// <summary>
        /// Delete data
        /// </summary>
        /// <param name="list">data list</param>
        /// <param name="po">printer object</param>
        /// <returns>if at least one item removed</returns>
        public static bool DeleteData(ListBox list, PrinterObject po)
        {
            bool atLeastOne = false;

            for (int index = list.SelectedIndices.Count - 1; index >= 0; --index)
            {
                int pos = list.SelectedIndices[index];
                po.DeleteData(pos);
                list.Items.RemoveAt(pos);
                hasModified = true;
                atLeastOne  = true;
            }
            list.Refresh();
            return(atLeastOne);
        }