复制按钮编码以创建一个按钮,该按钮可以从文本框中复制文本 [英] copy button cod e to create a button which can copy the text from textbox

查看:76
本文介绍了复制按钮编码以创建一个按钮,该按钮可以从文本框中复制文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何创建一个可以从文本框中复制文本的按钮
并且可以将文本粘贴到窗口中的任何位置(例如文件夹名称,文本文件,写字板等)中

请给我发送用于vb 2008的此操作的代码至hardeepkinng2009@gmail.com

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

推荐答案

按钮单击事件将以下代码编写为:
On Button Click Event Write the followin Code :
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


希望对您有帮助.:)

--MKB


I Hope It will help you.:)

--MKB


Button Click 事件中,使用以下代码
In the Click event of Button use the following code
System.Windows.Forms.Clipboard.SetText(TextBox1.Text.Trim(), System.Windows.Forms.TextDataFormat.Text)


使用上面的代码,将TextBox 中的Text 复制到clip board,然后可以将文本粘贴到所需的位置.


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.


这篇关于复制按钮编码以创建一个按钮,该按钮可以从文本框中复制文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆