/// <summary> /// Delete a chosen channel. /// </summary> public void DeleteChannel() { statusLabel.Text = "Deleting channel..."; DialogResult result = MessageBox.Show("Are you sure you want to delete the current Channel? Doing so will also delete all the News Items for that Channel.", "Delete Folder?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly, false); if (result == DialogResult.Yes) { int rowsAffected = channelTableAdapter.Update(rssDataSet); try { // Delete NewsItems associated with this Channel. int channelID = (int)channelsListBox.SelectedValue; DeleteNewsItems(channelID); // Delete the Channel. rssDataSet.ChannelRow channel = rssDataSet.Channel.FindByChannelID(channelID); channel.Delete(); if (rowsAffected > 0) { statusLabel.Text = "Channel deleted successfully."; } else { statusLabel.Text = "Problem deleting channel."; } } catch (Exception ex) { MessageBox.Show("Problem deleting channel: " + ex.Message); } } else { statusLabel.Text = "Delete channel operation cancelled."; } }