火车浏览器官方论坛

标题: c#写入剪贴板报错 [打印本页]

作者: holilz    时间: 2019-8-21 09:26
标题: c#写入剪贴板报错
  1. public static void Execute(Dictionary<string, string> stringDic,Dictionary<string, List<string>> listDic, Dictionary<string, int> intDic)

  2.         {

  3. System.Windows.Forms.Clipboard.SetText(stringDic["文件集"]);

  4.         }
复制代码

c#把变量写入剪贴板
  1. System.Windows.Forms.Clipboard.SetText(stringDic["文件集"]);
复制代码


单步测试正常
打包时或测试运行时出错


运行C#代码:编译出错:调用的目标发生了异常。在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式。请确保您的 Main 函数带有 STAThreadAttribute 标记。

怎么解决

作者: holilz    时间: 2019-8-21 10:00
6.6报错,导入7.3错误依然在。需要在7.3重写就正常了




欢迎光临 火车浏览器官方论坛 (http://bbs.locoyposter.com/) Powered by Discuz! X3.2