Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

How can I copy text from a text box to the clipboard

I am looking for a method to copy data from an asp.net webpage to the computers clipboard.

I've seen some people say use System.Windows.Forms - but when i try to declare that for import it doesn't show up. I've also read that you shouldn't use this in web applications.

What is the correct way to implement a simple copy to clipboard from a single multiline text box?
0
newimagent
Asked:
newimagent
  • 5
  • 4
2 Solutions
 
Rajkumar GsSoftware EngineerCommented:
You can use 'Clipboard' for this purpose.
Like explained here - http://bytes.com/topic/visual-basic-net/answers/347730-copy-cut-paste

Raj
0
 
Rajkumar GsSoftware EngineerCommented:
0
 
newimagentAuthor Commented:
"Clipboard" is not an available control for me. I have System.Web.UI.Control declared. What am i missing?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
newimagentAuthor Commented:
I'm not sure the second link is good because that is for windows forms. I read somewhere that in asp.net you should use the System.Web.UI controls not System.Windows.Forms
0
 
Rajkumar GsSoftware EngineerCommented:
Yes. I got confused that you are in windows forms. Let me check for Asp.Net

Raj
0
 
Rajkumar GsSoftware EngineerCommented:
I believe - this is the right solution for you in ASP.Net - http://forums.asp.net/t/1077651.aspx

Using clipboardData Object - http://msdn.microsoft.com/en-us/library/ms535220.aspx

Hope this helps
Raj
0
 
newimagentAuthor Commented:
from what I have been reading it looks like to do this in a web page requires javascript. the copy to clipboard cannot be performed from the code behind page. still researching just fyi
0
 
jagrut_patelCommented:
This discussion will give you useful pointers.
0
 
Rajkumar GsSoftware EngineerCommented:
0
 
newimagentAuthor Commented:
Using the VB clipboard object with multiple users can cause undesired results. Keeping it on the host side is the best answer and because of browser security and difficulty to implement cross platform I'm going to give jagrut_patel credit. That thread does make a valid point. While nice to fully automate the process it's probably best not to especially when folks using this app will be running an assortment of browsers because thats what people in my company do for some reason.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now