Csharp,如何从基于托盘的应用程序调用表单对象
可能的重复:
C#,如何调用表单对象来自基于托盘的应用程序
大家好,
我正在尝试从最初使用的作为托盘图标运行的程序加载表单类 “文件列表 frmFileList = new FileList();”现在我想使用自定义表单而不是文件列表,但出现错误: 错误 1“System.Windows.Forms.Control.ControlCollection”不包含“Cast”的定义,并且找不到接受“System.Windows.Forms.Control.ControlCollection”类型的第一个参数的扩展方法“Cast”(您是否缺少 using 指令或程序集引用?) 有什么想法吗?
Possible Duplicate:
C#, how to call a form object from a tray based application
Hi guys,
Iam trying to load a form class from a program running as a tray icon that originally used
"FileList frmFileList = new FileList();" Now instead of a filelist I want to use a custom form but I get the error:
Error 1 'System.Windows.Forms.Control.ControlCollection' does not contain a definition for 'Cast' and no extension method 'Cast' accepting a first argument of type 'System.Windows.Forms.Control.ControlCollection' could be found (are you missing a using directive or an assembly reference?)
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您好像忘记了源文件顶部的
using System.Linq;
。但由于你没有发布来源,我不能确定。发布导致错误消息的代码行以及同一文件中的using
指令会有所帮助。It sounds like you forgot
using System.Linq;
at the top of your source file. But since you didn't post the sources, I can't say for sure. Posting the line of code that causes the error message, and theusing
directives that are in that same file would help.