No control for RTBs with context menu

aewarnick

Senior Contributor
Joined
Jan 29, 2003
Messages
1,031
I have this test to see which control the contex menu pops up for but the problem is that it works for labels but not for Rich text boxes. In other words, when I right click on a text box no control is displayed in the messagebox but for labels it does.

private void contextMenu1_Popup(object sender, System.EventArgs e)
{
MessageBox.Show(""+this.contextMenu1.SourceControl);
}

Is that normal? I have in VSC# the Context menu section set to the same context menu for both.
 
Please answer this, I am having much trouble figuring out why it works for labels and not for the text boxes.

Also, you might want to know that when I do right click on a label the messagebox shows it is a label with the text property and when I right click on a textbox after that there is something in the messageBox but it is the label info.

However, this method works: this.RTB1.Copy(); What did I do wrong?
 
Last edited:
I got the context menu to work for rtb's but it still does not show any source control here:

private void contextMenu1_Popup(object sender, System.EventArgs e)
{
MessageBox.Show(""+this.contextMenu1.SourceControl);
}

Does anyone know why?
 
Back
Top