示例#1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddAlbumButton_Click(object sender, EventArgs e)
        {
            // In the main form, the user clicked the AddAlbum button
            // this causes an AddAlbum form to pop-up
            DialogResult dr = new DialogResult();
            AddAlbumWF frm = new AddAlbumWF();

            // After the AddAlbum form has been closed, determine why
            dr = frm.ShowDialog();
            if (dr == DialogResult.OK)
            {
                // The user clicked the OK button
                MessageBox.Show("Main: AddAlbum: User clicked OK button");
                // Refresh the datagrid
                this.albumViewTableAdapter.Fill(this.cDCatalogDataSet.AlbumView);

                // the following did not work with selecting a row and did not fill the entire grid (of course):
                // List<CDCatalogEF.Album> albumList = Album.GetAllAlbums();
                // this.albumDataGridView.DataSource = albumList;
            }
            else if (dr == DialogResult.Cancel)
            {
                // The user clicked the Cancel button
                MessageBox.Show("Main: AddAlbum: User clicked Cancel button");
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddAlbumButton_Click(object sender, EventArgs e)
        {
            // In the main form, the user clicked the AddAlbum button
            // this causes an AddAlbum form to pop-up
            DialogResult dr  = new DialogResult();
            AddAlbumWF   frm = new AddAlbumWF();

            // After the AddAlbum form has been closed, determine why
            dr = frm.ShowDialog();
            if (dr == DialogResult.OK)
            {
                // The user clicked the OK button
                MessageBox.Show("Main: AddAlbum: User clicked OK button");
                // Refresh the datagrid
                this.albumViewTableAdapter.Fill(this.cDCatalogDataSet.AlbumView);

                // the following did not work with selecting a row and did not fill the entire grid (of course):
                // List<CDCatalogEF.Album> albumList = Album.GetAllAlbums();
                // this.albumDataGridView.DataSource = albumList;
            }
            else if (dr == DialogResult.Cancel)
            {
                // The user clicked the Cancel button
                MessageBox.Show("Main: AddAlbum: User clicked Cancel button");
            }
        }