943,701 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 11213
  • VB.NET RSS
May 28th, 2008
0

Using cut, copy and paste in textbox

Expand Post »
Hi masters, i need codes to cut, copy and paste text from textbox.
i know that i can use shortcut like Ctrl + X, Ctrl + C and Ctrl + V, but i need to do it in code.
please help me

Anyhelp will appreciated much

Regards
Ela
Similar Threads
Reputation Points: 37
Solved Threads: 7
Junior Poster in Training
Estella is offline Offline
99 posts
since Jan 2008
May 28th, 2008
1

Re: Using cut, copy and paste in textbox

Use Clipboard...
Reputation Points: 38
Solved Threads: 6
Junior Poster in Training
Sawamura is offline Offline
65 posts
since Nov 2007
May 28th, 2008
2

Re: Using cut, copy and paste in textbox

Hi...
Like Sawamura said using clipboard
Try this following procedure, u can call in any event :
vb/net Syntax (Toggle Plain Text)
  1. Private Sub Cut()
  2. If Me.Textbox1.Text.Length > 0 Then
  3. Clipboard.SetDataObject(Me.Textbox1.SelectedText)
  4. Me.Textbox1.Cut()
  5. End If
  6. End Sub
  7.  
  8. Private Sub Copy()
  9. If Me.Textbox1.Text.Length > 0 Then
  10. Me.Textbox1.Copy()
  11. End If
  12. End Sub
  13.  
  14. Private Sub Paste()
  15. If Clipboard.GetDataObject.GetDataPresent(DataFormats.Text) Then
  16. Me.Textbox1.Paste()
  17. End If
  18. End Sub
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007
May 29th, 2008
0

Re: Using cut, copy and paste in textbox

Click to Expand / Collapse  Quote originally posted by Sawamura ...
Use Clipboard...
Hi sawamura...
thx for reply, i know that i must use clipboard but i didn't know how to code it.
Reputation Points: 37
Solved Threads: 7
Junior Poster in Training
Estella is offline Offline
99 posts
since Jan 2008
May 29th, 2008
0

Re: Using cut, copy and paste in textbox

Click to Expand / Collapse  Quote originally posted by Jx_Man ...
Hi...
Like Sawamura said using clipboard
Try this following procedure, u can call in any event :
vb/net Syntax (Toggle Plain Text)
  1. Private Sub Cut()
  2. If Me.Textbox1.Text.Length > 0 Then
  3. Clipboard.SetDataObject(Me.Textbox1.SelectedText)
  4. Me.Textbox1.Cut()
  5. End If
  6. End Sub
  7.  
  8. Private Sub Copy()
  9. If Me.Textbox1.Text.Length > 0 Then
  10. Me.Textbox1.Copy()
  11. End If
  12. End Sub
  13.  
  14. Private Sub Paste()
  15. If Clipboard.GetDataObject.GetDataPresent(DataFormats.Text) Then
  16. Me.Textbox1.Paste()
  17. End If
  18. End Sub
Hi jx_man thx for the reply, i will try ur code now and back to give some feedback
Reputation Points: 37
Solved Threads: 7
Junior Poster in Training
Estella is offline Offline
99 posts
since Jan 2008
May 29th, 2008
0

Re: Using cut, copy and paste in textbox

Click to Expand / Collapse  Quote originally posted by Estella ...
Hi sawamura...
thx for reply, i know that i must use clipboard but i didn't know how to code it.
i Think jx_man has a great code in his post.
Reputation Points: 38
Solved Threads: 6
Junior Poster in Training
Sawamura is offline Offline
65 posts
since Nov 2007
May 29th, 2008
0

Re: Using cut, copy and paste in textbox

yes, please give a feedback
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007
May 30th, 2008
0

Re: Using cut, copy and paste in textbox

yes, worked perfectly
Reputation Points: 37
Solved Threads: 7
Junior Poster in Training
Estella is offline Offline
99 posts
since Jan 2008
May 30th, 2008
0

Re: Using cut, copy and paste in textbox

Nice to help
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007
Jun 23rd, 2010
0

Excel-clipboard-gridview

Hello,
i am working with vs2008 (web application) and I want to copy some content from an excel sheet and and using the clipboard i want to copy the contents in a gridview

I have tried using Clipboard.GetDataObject() but no matter what ever i do it is always returning null so can anyone suggest me solution of how to implement this.

regards,
vamsi.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vamsikrishna20 is offline Offline
6 posts
since Jun 2010

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: how to print run time created table
Next Thread in VB.NET Forum Timeline: Re: Copy from excel --> clipborad --> datagridview





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC