I have a System.Windows.Forms.Form and want to change the Form.Icon at runtime to display a status. I\'ve managed to load the icon from the projects ressources:
Ok, Siva and Hans where right: GetObject returned null, because the name of the ressource wasn't right. With the following change it works:
Type type = this.GetType();
System.Resources.ResourceManager resources =
new System.Resources.ResourceManager(type.Namespace + ".Properties.Resources", this.GetType().Assembly);
// here it comes, call GetObject just with the resource name, no namespace and no extension
this.Icon = (System.Drawing.Icon)resources.GetObject(statusText);
Thanks for all your help.