473,729 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cut / Copy / Paste ????

I was checking out the 101 C# Samples, specifically Windows Forms - Use the Clipboard. I took a look at the code for a while, and I understand what the program is doing with the cut, copy, pasting via the file menu events using the clipboard. However, what I don't get is how is the program able to produce a context menu in the textbox area. When right clicking, the context pops up and allows to cut/copy/paste/delete, etc..

But the thing is, I don't see a context menu assigned to txtPaste in Visual Studio properties box. Even then, when I search for the cut/copy/paste code, I come up short. Nothing. What kind of magic is this? I know of the textbox.copy(), textbox.cut(), textbox.paste() functions for a textbox control box. But I don't see this being used at all

Even then, I tried viewing other sample codes to see if any code pops up screaming at me here I am. But no. Same thing. There's no site of the right click context menu with the cut/copy/paste selection. Am I missing something here? I want to get in on the secret invisible coding that allows cut/copy/paste

I was wondering if there exists a much quicker way to implement cut/copy/paste without going through the entire windows form's textboxes and manually creating each cut/copy/paste function. That sounds the stupid and hardway. There must be an easier way... Looks like the Using the Clipboard sample code does such thing (along with other code samples I've looked at), without showing a lot of coding for cut/copy/paste events

Help?
Nov 16 '05 #1
4 21618
Legendary Pansy wrote:
[...]
But the thing is, I don't see a context menu assigned to txtPaste [...]


I think you're asking why text boxes provide a context-menu which allows
one to cut, copy and paste without any coding required.

Well, text boxes automatically provide a context-menu which allows the
user to undo, cut, copy, paste, delete and select all. When you use a
text box, you automatically get all this functionality with it.
Nov 16 '05 #2
Thanks for the reply C# Learner. You're right. It is automatically generated. Sweet, less coding for me. So I'll turn to my next problem: is there a quick way to do the richtextbox or do I have to manually code that in? When I placed the textbox, I can see it generated the context menu automatically. That's great. But when I put in the richtextbox, there's no context menu. Although the richtextbox doesn't have context menu, the functionality of cut/copy/paste exists from Ctrl+X, Ctrl+C, Ctrl+V

Is there a quick way to generate the context menu that the textbox has for richtextbox or do I have to emulate it and code in the context menu myself

Thanks.
Nov 16 '05 #3
Legendary Pansy wrote:
[...]
Is there a quick way to generate the context menu that the textbox has for richtextbox
or do I have to emulate it and code in the context menu myself?
[...]


Yeah, I believe you'll have to do it manually, with a RichTextBox.

You can use a ContextMenu component, assign the reference to
RichTextBox.Con textMenu, then respond to the ContextMenu click events,
calling RichTextBox.Cut , RichTextBox.Cop y, etc.
Nov 16 '05 #4
Thanks for your input. Appreciate it.
Nov 16 '05 #5

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

Similar topics

3
2399
by: Rachel Suddeth | last post by:
This may not be the right forum, but it's a problem I chiefly come across when trying to post here. When I do a copy/paste from VS, the text always looks really weird (and even if I'm in an editor that's supposed to be doing plain text, it looks like it's in a different font -- and of course you can't change the font in a plain text editor.) Then when it gets converted to actual plain text, there is a blank line stuck in between every...
2
4817
by: Matt | last post by:
Hello, I have a copy button and a paste button. What code should I add to the copy button and the paste button to do it's work? Thanks, Matt
7
11630
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard is proving to be more difficult. These pictureboxes are bound to an AccessDB. If the user wants to add an image, they select an image using an OpenFileDialog: Dim result As DialogResult = Pic_Sel.ShowDialog() If (result = DialogResult.OK) Then
0
1535
by: jshoffner | last post by:
This sounds like a really silly question but I'm can't find a solution anywhere. I use the Search window within VS.NET 2003 all the time. However, when I find a sample that is usefull I would like to just copy that bit of code and paste into another window. I highlight what I'm wanting to copy and then CTRL-C (or Edit>Copy or Copy button from menu) and then I go there were I want to paste the copied string and do a CTRL-V (or Edit>Paste...
5
13992
by: Kaur | last post by:
Hi, I have been successful copying a vba code from one of your posts on how to copy and paste a record by declaring the desired fields that needs to be copied in form's declaration and creating two button "copy" and "paste". Works like magic. My problem is how can I copy multiple records and paste them at the same time. My data entry form has main form that has a Questionlist box of Questions. The second list box on the same form displays...
6
9653
by: Ben R. | last post by:
Hi, I've got a vb.net winforms app. Out of the box, I can use Ctrl X, C and V as expected in controls like textboxes. I've got a menustrip, and if I click the link "Add standard items" which adds Cut copy and paste commands, this functionality no longer works. It seems now I need to implement handlers for these functions. I tried to do so, but say the paste handler, I need to call paste on a specific control and that isn't necessarily...
17
5125
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 about 20 textboxes on the form). Also to ensure that the button can't get used if the cursor isn't in a textbox field. And to ensure the contents of the clipboard are "text" contents that have been cut/copied from one of the textboxes on the form. ...
5
11146
by: phill86 | last post by:
Hi I have a main form that holds records for scheduled meetings, date time location etc... in that form i have a sub form that has a list of equipment resources that you can assign to the meeting in the main form. I have two buttons in the sub form one for selecting and copying all the records and another for pasting the records this enables me to copy and paste the equipment resources from one scheduled meeting to another. The buttons are...
8
15438
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
8921
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8763
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9284
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2683
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.