C#中如何取到系统剪贴板的值? 要求是,在EXCEL中选中一列值,比如:12312334545然后按CTRL+C,或者复制,要求在C#中,取出这些值,然后分行取值,放到一列文本框中请问有什么控件能用WINDOWS的剪贴板。或者有什么思路解决这个问题!谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 it is easy.you can use: System.Windows.Forms.Clipboardclass http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/vbcon/html/vbtskretrievinginformationfromclipboard.asp 现在的问题是我是WEB项目,但是用到了WINDOWS后,就报错了 System.Windows.Forms.IDataObject iData = System.Windows.Forms.Clipboard.GetDataObject(); if(iData.GetDataPresent(System.Windows.Forms.DataFormats.Text)) { string strValue=(string)iData.GetData(System.Windows.Forms.DataFormats.Text); string[] res=strValue.Split((char)13); foreach (string str in res) { MessageBox.Show(str.Trim()); } } 根据MSDN上的代码,为很么执行的时候会在"if(iData.GetDataPresent(DataFormats.Text)) "报System.NullReferenceException错private void Page_Load(object sender, System.EventArgs e) { System.Windows.Forms.IDataObject iData = System.Windows.Forms.Clipboard.GetDataObject(); if(iData.GetDataPresent(DataFormats.Text)) { string strValue=iData.GetData(DataFormats.Text).ToString(); Label1.Text="strValue"; } } 请问如何下载保存gif图片 C# new运算符和C++ new运算符的 区别 问题 .Net 打 包 的 安 装 程 序 是 否 可 以 默 认 到 某 个 文件夹??? 请问,是否*.asmx文件引用的dll文件一定要放在WebService/bin下面,如放其他目录怎么设置。 一对多对象的类设计 使用C#开发IE工具条,类似Yahoo,Google,Alexa的,各位支招 汉字的长度 连接oracle数据库时时间查询问题 DataGrid和DataRelation菜鸟问题,请高手指教,急! 有关winform中获得窗体大小的问题 怎样取一个汉字的Unicode编码?急!!!!!
you can use: System.Windows.Forms.Clipboard
class
if(iData.GetDataPresent(System.Windows.Forms.DataFormats.Text))
{
string strValue=(string)iData.GetData(System.Windows.Forms.DataFormats.Text);
string[] res=strValue.Split((char)13);
foreach (string str in res)
{
MessageBox.Show(str.Trim());
}
}
private void Page_Load(object sender, System.EventArgs e)
{
System.Windows.Forms.IDataObject iData = System.Windows.Forms.Clipboard.GetDataObject();
if(iData.GetDataPresent(DataFormats.Text))
{
string strValue=iData.GetData(DataFormats.Text).ToString();
Label1.Text="strValue";
} }