private void removeChannelButton_Click(object sender, EventArgs e) { if (channelsList.SelectedIndex >= 0) { ChannelItem channelToRemove = (ChannelItem)channelsList.Items[channelsList.SelectedIndex]; Rule rule = rulesList.SelectedItems[0].Tag as Rule; rule.Channels.Remove(channelToRemove.channel); ArchiverMain.Current.ChannelsSettings.Save(); RefreshChannelsList(); } }