473,499 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy text from TextBox

How can I cut/copy/paste text from/into textbox using clipboard from my
code?
Nov 17 '05 #1
2 19023
You can use the Clipboard class. For example:

Copying
******
Clipboard.SetDataObject(MyTextbox.SelectedText, true);

Cutting
******
Clipboard.SetDataObject(MyTextbox.SelectedText, true);
MyTextbox.Text = string.Empty;

Pasting
******
IDataObject data = Clipboard.GetDataObject();

if (data.GetDataPresent(DataFormats.Text))
MyTextBox.Text = (string) data.GetData(DataFormats.Text);

Regards,
--
Angel J. Hernández M.
MCP - MCAD - MCSD - MCDBA
http://groups.msn.com/desarrolladoresmiranda


"David Dvali" <da*********@hotmail.com> wrote in message
news:u5**************@tk2msftngp13.phx.gbl...
How can I cut/copy/paste text from/into textbox using clipboard from my
code?

Nov 17 '05 #2
"David Dvali" <da*********@hotmail.com> wrote in message
news:u5**************@tk2msftngp13.phx.gbl...
How can I cut/copy/paste text from/into textbox using clipboard from my
code?


The textbox control has Copy(), Cut(), and Paste() methods.

-- Alan
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
927
by: DL | last post by:
Hi, I have an app. that opens pdf documents. Now i would like to use the text selectiontool of the pdf interface to select text and then when a user presses a button it should automatically copy...
1
1690
by: Tomomichi Amano | last post by:
Hello. I was wondering how to paste-copy-cut-delete at a SELECTED SPOT in a textBox. Thanks in advance.
6
2601
by: NuB | last post by:
I have a winform and a menu on the form, It allows the users to copy and paste text from text boxes. I never had to do this before, how can I copy and paste text from one box to another?
2
2286
by: Wayne Wengert | last post by:
I am trying to copy the text from a textbox to the clipboard. I saw some code posted earlier for Pasting from the clipboard so I modified it for copy but it is not working (see code below). When I...
13
2383
by: John | last post by:
Hi How can I implement cut or copy or paste in code? Thanks Regards
11
2091
by: F. Michael Miller | last post by:
I'd like to copy the listing of a directory (& sub directories) to a text file in vb.net. I'm looking for teh equivilant of the DOS command dir /s > TargetFile.txt. Thanks!
17
5073
by: Steve | last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user clicks on a toolbar button, the cut/copy/paste will work with whatever textbox the cursor is current located in (I have...
0
2118
by: Tom | last post by:
When I use ctrl-c to copy and ctrl-v to paste from a RichTextBox into NotePad ... I get nice ASCII text with the proper returns. Everything looks good. When I paste into WordPad ... I get the...
11
9623
by: John | last post by:
Hi In a winform app I need to provide a menu with Cut, Copy and Paste options., What code do I use to accomplish cut, copy and paste features for fields on a winfrom? Thanks Regards
8
15389
by: jh | last post by:
I'd like to copy/paste into a listbox during runtime. I can do this for a textbox but can't figure out how to accomplish this for a listbox. Any help? Thanks.
0
7132
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7009
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5475
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.