Hi Everybody,
The following code can run in VB6.0 to cut a text:
Private Sub mnuCut_Click ()
Clipboard.Clear
Clipboard.SetText Screen.ActiveControl.SelText
Screen.ActiveControl.SelText = ""
End Sub
Can any body please help me and suggest a corresponding code for VB Express
I would be really thankful.
Vishal

Copy, Cut, and Paste commands with any text box
MDesigner
you can use the textbox Cut method to cut the selected text, so be sure to select text in the textbox, then do a Cut() method call which will store it in the clipboard.
Me.theTextBox.Select(0, Me.theTextBox.Text.Length)
Me.theTextBox.Cut()
Same thing also applies for copy and paste
Alternatively you could also do this to copy to clipboard:
Clipboard.SetText(Me.theTextBox.Text)
Mark Macumber
Yes this command is also working fine. But it wont copy the selected text. It actually copies all the text in the active control.
I appreciate your help thank you very much.
Lejing
Thanks for your reply.
But if I use it like that. Then for every textbox I have to write the same code. Isn't there any general code to do that like the one I have given as an example in my original post.
I appreciate your help.
Vishal
John.Doe
well how would you expect to copy/cut/paste text from textboxes :-)
maybe try this (untested)
Clipboard.SetText(Me.ActiveControl.Text)
however this will get the text for the active control, be it a command button or a groupbox or whatever control is active currently
another way perhaps would be to check to see if the active control is a textbox, if so, then do your thing
if Me.ActiveControl.GetType() Is GetType(TextBox) then
Dim currentControl as TextBox = CType(Me.ActiveControl, TextBox)
'copy/cut/paste from currentControl
end if