Using cut, copy and paste in textbox

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jan 2008
Posts: 97
Reputation: Estella is an unknown quantity at this point 
Solved Threads: 6
Estella's Avatar
Estella Estella is offline Offline
Junior Poster in Training

Using cut, copy and paste in textbox

 
0
  #1
May 28th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 63
Reputation: Sawamura is an unknown quantity at this point 
Solved Threads: 6
Sawamura's Avatar
Sawamura Sawamura is offline Offline
Junior Poster in Training

Re: Using cut, copy and paste in textbox

 
1
  #2
May 28th, 2008
Use Clipboard...
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Using cut, copy and paste in textbox

 
2
  #3
May 28th, 2008
Hi...
Like Sawamura said using clipboard
Try this following procedure, u can call in any event :
  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
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 97
Reputation: Estella is an unknown quantity at this point 
Solved Threads: 6
Estella's Avatar
Estella Estella is offline Offline
Junior Poster in Training

Re: Using cut, copy and paste in textbox

 
0
  #4
May 29th, 2008
Originally Posted by Sawamura View Post
Use Clipboard...
Hi sawamura...
thx for reply, i know that i must use clipboard but i didn't know how to code it.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 97
Reputation: Estella is an unknown quantity at this point 
Solved Threads: 6
Estella's Avatar
Estella Estella is offline Offline
Junior Poster in Training

Re: Using cut, copy and paste in textbox

 
0
  #5
May 29th, 2008
Originally Posted by Jx_Man View Post
Hi...
Like Sawamura said using clipboard
Try this following procedure, u can call in any event :
  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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 63
Reputation: Sawamura is an unknown quantity at this point 
Solved Threads: 6
Sawamura's Avatar
Sawamura Sawamura is offline Offline
Junior Poster in Training

Re: Using cut, copy and paste in textbox

 
0
  #6
May 29th, 2008
Originally Posted by Estella View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Using cut, copy and paste in textbox

 
0
  #7
May 29th, 2008
yes, please give a feedback
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 97
Reputation: Estella is an unknown quantity at this point 
Solved Threads: 6
Estella's Avatar
Estella Estella is offline Offline
Junior Poster in Training

Re: Using cut, copy and paste in textbox

 
0
  #8
May 30th, 2008
yes, worked perfectly
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Using cut, copy and paste in textbox

 
0
  #9
May 30th, 2008
Nice to help
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC