I searched for a similar question and could not find any solutions. I am building a GUI based application in c#. I have a button and the onclick function for it. It is like this:
void button_choose_directory_Click(object sender, EventArgs e)//Choose folder where client will download the files
{
FolderBrowserDialog chooseDirectory = new FolderBrowserDialog();
if (chooseDirectory.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
downloadDirectory = chooseDirectory.SelectedPath;
client.downloadDirectory = downloadDirectory;
textbox_save_directory.Text = downloadDirectory;
}
}
I accidentally double clicked again to that button and another function was automatically created.
private void button_choose_directory_Click_1(object sender, EventArgs e)
{
}
Now if i delete this function program gives error and does not compile. How can i fix this? I do not want this unnecessary piece of code in my program.
Error message is like this:
FileTransferClient.Form1' does not contain a definition for
'button_choose_directory_Click_1' and no extension method
'button_choose_directory_Click_1' accepting a first argument of type
'FileTransferClient.Form1' could be found (are you missing a using directive or an
assembly reference?)
Thanks
CTRL+Fforbutton_choose_directory_Click_1and delete it. You've deleted method but it seems that there are still some event subscriptions.