0

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?

Community
  • 1
  • 1
DOSrelic
  • 1
  • 1
  • 2
  • 2
    Dupe of poster's earlier question: http://stackoverflow.com/questions/4568815/c-how-to-call-a-form-object-from-a-tray-based-application. Please don't repost questions. – Michael Petrotta Dec 31 '10 at 08:23

1 Answers1

1

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.

cdhowie
  • 158,093
  • 24
  • 286
  • 300
  • OMG cdhowie FANTASTIC! However it now brings up the problem of: SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application. So do you or any other brilliant mind know how to get round this please? Can I swap the IWin32Window object or...*blush*... Where even would this have been ceated? Cheers dude. lol – DOSrelic Dec 31 '10 at 09:44
  • 1
    Where are you calling `SetCompatibleTextRenderingDefault`? Can this be moved to your `Main` method so it only gets called once, before any window objects are created? – cdhowie Dec 31 '10 at 09:45