Ejemplo n.º 1
0
        /// <summary>
        /// Called as we click the 'New' button to add a new publisher
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnNewPublisher_Click(object sender, EventArgs e)
        {
            FormAskInput1 askPublisher = new FormAskInput1("Please enter the name of a new Publisher", "New Publisher", "Publisher:");

            if (askPublisher.ShowDialog() == DialogResult.OK)
            {
                // Ensure that this name is not already in our list and if not add and select it
                string            newPublisher = askPublisher.ValueEntered();
                UltraListViewItem itemToSelect = null;
                int index = lvPublishers.Items.IndexOf(newPublisher);
                if (index == -1)
                {
                    index = lvPublishers.Items.Add(new UltraListViewItem(newPublisher, null));
                }
                itemToSelect = lvPublishers.Items[index];

                // Bring the new item into view and select it
                itemToSelect.BringIntoView();
                lvPublishers.SelectedItems.Add(itemToSelect, true);
            }
        }