コード例 #1
0
        private void addGenreButton_Click(object sender, EventArgs e)
        {
            // The user clicked the addGenreButton on the AddSong form.
            // this creates an AddGenre pop-up.
            AddGenreWF   frm = new AddGenreWF();
            DialogResult dr  = frm.ShowDialog(this);

            // If the user clicked the OK button on the AddGenre pop-up
            if (dr == DialogResult.OK)
            {
                // MessageBox.Show("User clicked OK button");
                // Get the newly created genre object
                CDCatalogEF.Genre genre = (Genre)this.addGenreButton.Tag;

                // Show updated list in the combo box
                this.genreTableAdapter.Fill(this.cDCatalogDataSet3.Genre);

                //Show the selected item
                this.genreComboBox.SelectedIndex = this.genreComboBox.FindString(genre.GenreName);

                this.Close();
            }
            // if the Cancel button or the X was clicked on the AddGenre pop-up...
            else if (dr == DialogResult.Cancel)
            {
                MessageBox.Show("User clicked Cancel button");
                this.Close();
            }
        }
コード例 #2
0
        private void AddGenreButton_Click(object sender, EventArgs e)
        {
            // In the AddAlbum form, the user clicked the AddGenre button
            // this opens the AddGenre pop-up
            DialogResult dr  = new DialogResult();
            AddGenreWF   frm = new AddGenreWF();

            // When the AddGenre pop-is closed, determine why.
            dr = frm.ShowDialog();
            if (dr == DialogResult.OK)
            {
                // MessageBox.Show("User clicked OK button");
                // Get the newly created genre object
                CDCatalogEF.Genre genre = (Genre)this.addGenreButton.Tag;

                // Show updated list in the combo box
                this.genreTableAdapter.Fill(this.cDCatalogDataSet3.Genre);

                //Show the selected item
                this.genreComboBox.SelectedIndex = this.genreComboBox.FindString(genre.GenreName);

                this.Close();
            }
            else if (dr == DialogResult.Cancel)
            {
                MessageBox.Show("AddGenre: User clicked Cancel button");
                this.Close();
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: WA4OSH/CsharpCapstone
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddGenreButton_Click(object sender, EventArgs e)
        {
            DialogResult dr  = new DialogResult();
            AddGenreWF   frm = new AddGenreWF();

            dr = frm.ShowDialog();
            if (dr == DialogResult.OK)
            {
                MessageBox.Show("Main: AddGenre User clicked OK button");
            }
            else if (dr == DialogResult.Cancel)
            {
                MessageBox.Show("Main: AddGenre User clicked Cancel button");
            }
        }