C#,如何从基于托盘的应用程序调用表单对象 [英] C#, how to call a form object from a tray based application

查看:15
本文介绍了C#,如何从基于托盘的应用程序调用表单对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从最初使用的作为托盘图标运行的程序加载表单类

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 指令或程序集参考?)

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?)

有什么想法吗?

推荐答案

听起来您好像忘记了源文件顶部的 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#,如何从基于托盘的应用程序调用表单对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆