hey everyone,
so i have this program i am workikng on, and i created a custom icon for it. i know that in visual studio i can just change the icon setting on the form to whatever icon i select and its changed. but i want to do it from within the program itself. that way if i feel like changing the icon to something different, i just write the path in the config file and it changes itself.
ideas?
here is the config key
i tried this:Code:<add key="icon" value="E:\Users\Owner\Documents\Visual Studio 2010\Projects\CS_CheckInCheckOut\CS_CheckInCheckOut\Icon.ico"/>
but it gave me this:Code:string iconpath = ConfigurationSettings.AppSettings["icon"]; public frmMain() { InitializeComponent(); this.KeyDown += new KeyEventHandler(frmMain_KeyDown); this.PreviewKeyDown += new PreviewKeyDownEventHandler(frmMain_PreviewKeyDown); textBox1.Text = "Last Name"; textBox2.Text = "First Name"; frmMain.Icon = iconpath; }
i am going to search around the internet for answers, but please help me understand this.Code:Error 2 An object reference is required for the non-static field, method, or property 'System.Windows.Forms.Form.Icon.get' E:\Users\Owner\documents\visual studio 2010\Projects\CS_CheckInCheckOut\CS_CheckInCheckOut\Form1.cs 28 13 CS_CheckInCheckOut
thanks in advance,
rockking




Reply With Quote
