我像在winfrom中一个控件,功能是复制texbox里的内容。这个功能怎么写
解决方案 »
- SQL2005连接问题
- 这样的验证码谁能识别,能给出代码谢之!
- 自定义控combobox怎么加入checkbox【传送门内有100分】
- BUTTON的click事件中不能执行Response.Write("<script language=javascrip> alert('hello');</script>");
- 软件打开好慢啊,有没有好的解决方案?大背景图片360K,另外还有一些背景图片也一起加载,大概500K左右,这个有没有影响?及其他注意的地方
- 数据绑定
- 如何用C#判断已经上网
- 求c#ppt开发获取ppt中的chart
- 在C#中,要使用“全局变量” ,如何解决?
- c# 操作 office2007给每一页添加不同的页眉
- .NET出错
- 处理excel的问题?
// Takes the selected text from a text box and puts it on the clipboard.
if(textBox1.SelectedText != "")
Clipboard.SetDataObject(textBox1.SelectedText);
else
textBox2.Text = "No text selected in textBox1";
} private void button2_Click(object sender, System.EventArgs e) {
// Declares an IDataObject to hold the data returned from the clipboard.
// Retrieves the data from the clipboard.
IDataObject iData = Clipboard.GetDataObject(); // Determines whether the data is in a format you can use.
if(iData.GetDataPresent(DataFormats.Text)) {
// Yes it is, so display it in a text box.
textBox2.Text = (String)iData.GetData(DataFormats.Text);
}
else {
// No it is not.
textBox2.Text = "Could not retrieve data off the clipboard.";
}
}
textbox2.text = textbox1.text;
if(非空)
str = textbox.text;
textbox2.text = str;
这样比较好.