path - C# Form application - Retrieve notification icon file app.config -


i trying develop windows form application works ok far. have 4 app.config files , configure properly.

my problem comes when try key notification icon.

i message cannot convert string drawing.icon. can gimme hint on this, please?

app.config:

<?xml version="1.0" encoding="utf-8"?> <configuration>   <appsettings>     <add key="customer" value="customer" />     <add key="link" value="http://link.i.need" />     <add key="icopath" value="properties.resources.firstlogo" />   </appsettings> </configuration>  

form functions ok:

private void formresize(object sender, eventargs e)         {             if (windowstate == formwindowstate.minimized)             {                 showintaskbar = true;                 notification.visible = true;                 notification.balloontiptext = "running in background...";                 **system.drawing.icon ico = properties.resources.firstlogo;**                 notification.icon = ico;                 notification.showballoontip(1000);             }         } 

form not:

private void formresize(object sender, eventargs e)         {             if (windowstate == formwindowstate.minimized)             {                 showintaskbar = true;                 notification.visible = true;                 notification.balloontiptext = "running in background...";                 **system.drawing.icon ico = configurationmanager.appsettings["icopath"].tostring();**                 notification.icon = ico;                 notification.showballoontip(1000);             }         } 

thank you.

try this:

system.drawing.icon ico = (system.drawing.icon)properties.resources.resourcemanager.getobject(configurationmanager.appsettings["icopath"].tostring()); 

thanks, eric


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -