Just to demonstrate how easy it is to go back and modify this code once it has been created, you are going to implement the Select All method that you added to your menu.
To do this, start by editing the ICutCopyPaste interface to include the following method signature:
Sub SelectAll()
Then add the code in Listing 6-13 to the frmEditBase class.
Listing 6-13: The SelectAll Method
Public Sub SelectAll() Implements ICutCopyPaste.SelectAll Dim txt As TextBoxBase If TypeOf ActiveControl Is TextBoxBase Then txt = CType(ActiveControl, TextBoxBase) txt.SelectAll() End If End Sub
This code calls the SelectAll method on the TextBoxBase control, which takes care of the work for you. Now you need to update your main form to invoke this method. Edit the Select Case statement in the MainMenu_Click method in the frmMain class so that it looks like the following:
Case "Cu&t", "&Copy", "&Paste", "Select Al&l" CutCopyPaste(mnu.Text)
Next, edit the CutCopyPaste routine by adding the following Case statement to the Select Case block:
Case "Select Al&l" objCCPU.SelectAll()
Now you should be able to click the Select All menu item to select all of the text in a textbox or richtextbox on any edit form. Of course you only have the one right now, but it works for everything.