You can do this, although the code you provide cannot be compiled. It should look like this:
private void txtbox1_DoubleClick(object sender, EventArgs e) { button1_Click(sender, e); } private void button1_Click(object sender, EventArgs e) { MessageBox.Show(txtbox1.Text); }
But for best practice and code readability, you are probably better off doing this, especially since you are not using sender and e :
private void txtbox1_DoubleClick(object sender, EventArgs e) { ShowMessageBox(); } private void button1_Click(object sender, EventArgs e) { ShowMessageBox(); } private void ShowMessageBox() { MessageBox.Show(txtbox1.Text); }
source share