コード例 #1
0
        private void AddArtistButton_Click(object sender, EventArgs e)
        {
            // In the AddAlbum form, the user clicked the AddArtist button
            // this opens the AddArtist pop-up
            DialogResult dr  = new DialogResult();
            AddArtistWF  frm = new AddArtistWF();

            // When the AddArtist pop-is closed, determie why.
            dr = frm.ShowDialog();
            if (dr == DialogResult.OK)
            {
                // Acknowledge the change
                MessageBox.Show("AddArtist: User clicked OK button");

                // Get the newly created genre object
                CDCatalogEF.Artist artist = (CDCatalogEF.Artist) this.addArtistButton.Tag;

                // Refresh the combo box with the artist that was just added
                this.artistTableAdapter.Fill(this.cDCatalogDataSet2.Artist);

                int index = artistComboBox.FindStringExact(artist.ArtistName);  //Exception here
                artistComboBox.SelectedIndex = index;

                this.Close();
            }
            else if (dr == DialogResult.Cancel)
            {
                MessageBox.Show("AddArtist: User clicked Cancel button");
                this.Close();
            }
        }
コード例 #2
0
        private void addArtistButton_Click(object sender, EventArgs e)
        {
            // The user clicked the addArtistButton on the AddArtist form.
            // this creates an AddArtist pop-up.
            AddArtistWF  frm = new AddArtistWF();
            DialogResult dr  = frm.ShowDialog(this);

            // If the user clicked the OK button on the AddArtist pop-up
            if (dr == DialogResult.OK)
            {
                // MessageBox.Show("User clicked OK button. Artist Name = " + _artistName );
                // Get the newly created genre object
                CDCatalogEF.Artist artist = (Artist)this.addArtistButton.Tag;

                // Refresh the combo box with the artist that was just added
                this.artistTableAdapter.Fill(this.cDCatalogDataSet2.Artist);

                int index = artistComboBox.FindStringExact(artist.ArtistName);  // unhandled exception ArtistName = null
                artistComboBox.SelectedIndex = index;

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

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

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