Click here to Skip to main content
15,885,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create a button which can copy the text from textbox
and that text can be paste anywhere in window(like foldername,in text file,in wordpad etc)

plz send me code for this operation for vb 2008 to hardeepkinng2009@gmail.com
Posted

On Button Click Event Write the followin Code :
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       'If You want to Copy Text from TextBox1
       Clipboard.SetData(System.Windows.Forms.DataFormats.StringFormat, TextBox1.Text)
End Sub

I Hope It will help you.:)

--MKB
 
Share this answer
 
Comments
HARDEEP_SAINI 31-Mar-12 7:21am    
thanks alot bro....
i do't know much about vb i just trying to make a keygen and from a video tutorial i come to know how to make a keygen but the problem is that i want that when i generate a key i want to copy that one and paste at desire location

i think my problem will end by ur solution
now i am gng to see ur code
HARDEEP_SAINI 31-Mar-12 7:30am    
yes it is exactly what i want
can i know how i would rate you or any thing else like in fb we like someone comment
i am new user to this site..............
HARDEEP_SAINI 31-Mar-12 8:12am    
and sir can u plz tell me how to give icon to application or form which i made
Manoj K Bhoir 2-Apr-12 0:23am    
It's easy.Whatever Icon File You want to Set for Your Application follow these steps:
Right Click On Prject Solution-Goto Properties-In Application Tab Browse the Icon which you want to set for your application.After that Build your Application.:)
In the Click event of Button use the following code
VB
System.Windows.Forms.Clipboard.SetText(TextBox1.Text.Trim(), System.Windows.Forms.TextDataFormat.Text)

with the above code the Text in the TextBox will be copied to the clip board, then the text can be paste at the desired location.
 
Share this answer
 
v2
Comments
HARDEEP_SAINI 31-Mar-12 7:13am    
thanks alot for rply.....
HARDEEP_SAINI 31-Mar-12 7:37am    
sorry sir but this is not what i want
but i will welcome u....
i want this
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'If You want to Copy Text from TextBox1
Clipboard.SetData(System.Windows.Forms.DataFormats.StringFormat, TextBox1.Text)
End Sub
HARDEEP_SAINI 31-Mar-12 7:41am    
but his is also same sorry.....................
i do't know much about vb

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900