问题描述
我正在尝试从最初使用的作为托盘图标运行的程序加载表单类
I am 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:
错误 1'System.Windows.Forms.Control.ControlCollection'不包含定义'Cast' 和无扩展方法 'Cast'接受类型的第一个参数'System.Windows.Forms.Control.ControlCollection'可以找到(你错过了using 指令或程序集参考?)
有什么想法吗?
推荐答案
听起来您好像忘记了源文件顶部的 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 the using
directives that are in that same file would help.
这篇关于C#,如何从基于托盘的应用程序调用表单对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!