Paste Text into TextBox

ADO DOT NET

Centurion
Joined
Dec 20, 2006
Messages
160
Hi,
When I want to paste a text into a text box I use this code:
Visual Basic:
Clipboard.SetText("My Text")
SubjectTextBox.Paste()
It has a problem: it removes the previous clipboard contents, is there a way to paste a specific text into text box without working with clipboard?
Thanks.
 
Is there a requirement to use the paste functionality at all? If so copying stuff to the clipboard removes the existing contents - this is how it is designed to work.

Could you not just assign the value directly to the text property?
 
You mean something like:
Visual Basic:
Dim SavedText As String = "My Text"
SubjectTextBox.Text += SavedText
Nope!
This won't work because I want to to be exactly pasted at the location of cursor, and if some text is marked be replaced, the same behavior as paste function.
I was thinking if it has a paste option that allow user to assign some text to be pasted instead of pasting from clipboard!
 
Back
Top