ColdPhreze
Programmer
- Apr 15, 2002
- 93
Ok, the subject says most of it. I have an app with multiple rich text boxes and multiple text boxes. I am using the copy, paste, selectall, and clear methods of the RTB and TB.
I have one context menu with the items Select All, Cut, Copy, Paste, and Clear. Following is the code I've attempted for the Select All. It only works in the text boxes. The problem is that the SourceControl of the context menu does NOT update when I use it with a Rich Text Box.
That all said, I would really prefer to do something like follows so I don't have to code in every text box or RTB. However, the code proposed below does not work because the sender is the context menu, not the textbox or RTB. If you have a solution similar to below (but that actually works
), I would much rather hear it than a solution to the SourceControl problem above.
Thanks in Advance,
KyferEz
Check out my DeVry Senior Project: and my CarPC Hardware: and my Spam-Fighter forums:
I have one context menu with the items Select All, Cut, Copy, Paste, and Clear. Following is the code I've attempted for the Select All. It only works in the text boxes. The problem is that the SourceControl of the context menu does NOT update when I use it with a Rich Text Box.
Code:
Private Sub miSelectAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miSelectAll.Click
If contextmenu.SourceControl Is txtbox1 Then
txtbox1.SelectAll()
ElseIf contextmenu.SourceControl Is txtbox2 Then
txtbox2.SelectAll()
ElseIf contextmenu.SourceControl Is rtb1 Then
rtb1.SelectAll()
ElseIf contextmenu.SourceControl Is rtb2 Then
rtb2.SelectAll()
End If
End Sub
That all said, I would really prefer to do something like follows so I don't have to code in every text box or RTB. However, the code proposed below does not work because the sender is the context menu, not the textbox or RTB. If you have a solution similar to below (but that actually works
Code:
Private Sub miSelectAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miSelectAll.Click
sender.SelectAll()
End Sub
Thanks in Advance,
KyferEz
Check out my DeVry Senior Project: and my CarPC Hardware: and my Spam-Fighter forums: