How to copy and paste text

  • Thread starter Thread starter Mamatha
  • Start date Start date
M

Mamatha

Hi

I have one application in VB.NET.In that one textbox
containing some data.I want to copy that data from that
textbox and paste it into the notepad or any other
application(where i want to paste).How can it possible in
VB.NET,if anyone knows please give me reply
 
In [email protected],
Mamatha said:
...I want to copy that data from that
textbox and paste it into the notepad

Hi Mamatha,

Here's some code posted elsewhere by VB MVP Paul Clement:

Private Sub PasteDataToNotepad()

' Minimize the current window, so that the new Notepad window
' will definitely have focus.
Me.WindowState = FormWindowState.Minimized

' Start notepad.exe
Dim proc As Process = Process.Start("notepad.exe")

' Wait a short while for Notepad to fully launch.
System.Threading.Thread.Sleep(250)

' Copy the data from the multi-line textbox into the clipboard.
Clipboard.SetDataObject(Me.TextBox1.Text)

' Send a Ctrl-V to Notepad to paste the data from the clipboard into
the text editor.
SendKeys.Send("^v")

End Sub
 
Hi Cindy,

While it is an inventive solution from Paul, does it me very much think on
the movie the Deerhunter.

I think it is better to use a temp file in this situation.

:-)

Cor
 
Back
Top