0

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

4
Contributors
9
Replies
22
Views
8 Years
Discussion Span
Last Post by vamsikrishna20
Featured Replies
  • Use Clipboard... Read More

  • 2

    Hi... Like Sawamura said using clipboard Try this following procedure, u can call in any event : [code=vb/net] Private Sub Cut() If Me.Textbox1.Text.Length > 0 Then Clipboard.SetDataObject(Me.Textbox1.SelectedText) Me.Textbox1.Cut() End If End Sub Private Sub Copy() If Me.Textbox1.Text.Length > 0 Then Me.Textbox1.Copy() End If End Sub Private Sub Paste() If Clipboard.GetDataObject.GetDataPresent(DataFormats.Text) … Read More

  • [QUOTE=Estella;616576]Hi sawamura... thx for reply, i know that i must use clipboard but i didn't know how to code it.[/QUOTE] i Think jx_man has a great code in his post. Read More

2

Hi...
Like Sawamura said using clipboard
Try this following procedure, u can call in any event :

Private Sub Cut()
    If Me.Textbox1.Text.Length > 0 Then
        Clipboard.SetDataObject(Me.Textbox1.SelectedText)
        Me.Textbox1.Cut()
    End If
End Sub

Private Sub Copy()
    If Me.Textbox1.Text.Length > 0 Then
        Me.Textbox1.Copy()
    End If
End Sub

Private Sub Paste()
    If Clipboard.GetDataObject.GetDataPresent(DataFormats.Text) Then
        Me.Textbox1.Paste()
    End If
End Sub
Comments
Good
Worked Perfectly
0

Use Clipboard...

Hi sawamura...
thx for reply, i know that i must use clipboard but i didn't know how to code it.

0

Hi...
Like Sawamura said using clipboard
Try this following procedure, u can call in any event :

Private Sub Cut()
    If Me.Textbox1.Text.Length > 0 Then
        Clipboard.SetDataObject(Me.Textbox1.SelectedText)
        Me.Textbox1.Cut()
    End If
End Sub

Private Sub Copy()
    If Me.Textbox1.Text.Length > 0 Then
        Me.Textbox1.Copy()
    End If
End Sub

Private Sub Paste()
    If Clipboard.GetDataObject.GetDataPresent(DataFormats.Text) Then
        Me.Textbox1.Paste()
    End If
End Sub

Hi jx_man thx for the reply, i will try ur code now and back to give some feedback

1

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.

Comments
Yes you're right
0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.