TEST ME
TEST ME

Reputation: 123

Programmatically change the program icon

I'm developing on VS 2010/ C#.

Does any one know how to change the software icon programmatically?

I actually want my software to have one icon under Windows 7 and another for Windows XP in the same software installation.

Upvotes: 1

Views: 5919

Answers (2)

Mohamed Salman
Mohamed Salman

Reputation: 29

 this.Icon = Icon.ExtractAssociatedIcon(@"Stringpath");

Upvotes: 0

sharp_net
sharp_net

Reputation: 737

If it's a winform app, you can write below code in the formload event of the main form.

Use this link to find operating system : http://andrewensley.com/2009/06/c-detect-windows-os-part-1/

and then write below code to set icon.

private void InvestorReportingFormLoad(object sender, EventArgs e)
        {
            this.Icon = Properties.Resources.coins;            
        }

Upvotes: 3

Related Questions