{"id":204,"date":"2009-03-11T17:51:00","date_gmt":"2009-03-11T17:51:00","guid":{"rendered":"http:\/\/windowsvj.com\/wpblog\/?p=204"},"modified":"2009-03-11T17:51:00","modified_gmt":"2009-03-11T17:51:00","slug":"copying-the-selected-text-in-a-textbox-to-clipboard","status":"publish","type":"post","link":"http:\/\/windowsvj.com\/wpblog\/2009\/03\/copying-the-selected-text-in-a-textbox-to-clipboard\/","title":{"rendered":"Copying the selected text in a textbox to clipboard"},"content":{"rendered":"<p><span id=\"dnn_ctr583_ContentPane\" class=\"DNNAligncenter\"><span id=\"spBody\" class=\"Forum_Normal\"><\/p>\n<p>Often in programming we ned to copy the selected text to the clipoard.<\/p>\n<p>Here is the method how to do this in visualbasic.net<\/p>\n<p>Copies the current selection in the text box to the Clipboard.<\/p>\n<pre class=\"syntax\"><span class=\"lang\">[Visual Basic]<br \/><\/span><b>Public Sub Copy()<\/b><\/pre>\n<h4 class=\"dtH4\">Remarks<\/h4>\n<p>You can use this method, instead of using the Clipboard class, to copy text in the text box and place it in the Clipboard.<\/p>\n<h4 class=\"dtH4\">Example<\/h4>\n<p><span class=\"lang\">[Visual Basic, C#, C++]<\/span> The following example uses TextBox, a derived class. It provides Click event handlers for MenuItem objects that perform Cut, Copy, Paste, and Undo operations. This example assumes that a <b>TextBox<\/b> control named <tt>textBox1<\/tt> has been created.<\/p>\n<pre class=\"code\"><span class=\"lang\">[Visual Basic]<\/span><br \/>Private Sub Menu_Copy(sender As System.Object, e As System.EventArgs)<br \/>   ' Ensure that text is selected in the text box.  <br \/>   If textBox1.SelectionLength > 0 Then<br \/>       ' Copy the selected text to the Clipboard.<br \/>       textBox1.Copy()<br \/>   End If<br \/>End Sub<br \/><br \/>Private Sub Menu_Cut(sender As System.Object, e As System.EventArgs)<br \/>   ' Ensure that text is currently selected in the text box.  <br \/>   If textBox1.SelectedText <> \"\" Then<br \/>       ' Cut the selected text in the control and paste it into the Clipboard.<br \/>       textBox1.Cut()<br \/>   End If<br \/>End Sub<br \/><br \/><\/pre>\n<p><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Often in programming we ned to copy the selected text to the clipoard. Here is the method how to do this in visualbasic.net Copies the current selection in the text box to the Clipboard. [Visual Basic]Public Sub Copy() Remarks You can use this method, instead of using the Clipboard class, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-204","post","type-post","status-publish","format-standard","hentry","category-net"],"_links":{"self":[{"href":"http:\/\/windowsvj.com\/wpblog\/wp-json\/wp\/v2\/posts\/204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/windowsvj.com\/wpblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/windowsvj.com\/wpblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/windowsvj.com\/wpblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/windowsvj.com\/wpblog\/wp-json\/wp\/v2\/comments?post=204"}],"version-history":[{"count":0,"href":"http:\/\/windowsvj.com\/wpblog\/wp-json\/wp\/v2\/posts\/204\/revisions"}],"wp:attachment":[{"href":"http:\/\/windowsvj.com\/wpblog\/wp-json\/wp\/v2\/media?parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/windowsvj.com\/wpblog\/wp-json\/wp\/v2\/categories?post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/windowsvj.com\/wpblog\/wp-json\/wp\/v2\/tags?post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}