TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Oriana Gonzalez
NA
3
0
How to change the default Icon of a win Form and including it in the .exe file?
Oct 6 2009 10:10 AM
Dear All,
I am new programming in c#, the first programs I am developing are not too big and I am developing them by hand, it means I am not using the VS wizzards. I compile the applications (console or winapp) from the command line. My problem is that I don't know how to change the default Icon of a Form and including it in the exe file. I mean I know that I have to use :
this.Icon = new Icon("myicon.ico");
to assign the Icon. The application works if I have the file myicon.ico in the same directory as the application but if I try to execute the application in another directory it crashes because it doesn't find the icon file, it produces a portability problem, I have already try with other code like:
Icon icon1 = (System.Drawing.Icon)this.FormResources.GetObject("myicon.ico");
or
Stream strm = (Stream) Assembly.GetExecutingAssembly().GetManifestResourceStream("myicon.ico");
this.Icon = new Icon(strm); <-- this didn't work I found the example in internet but I don't know if the type stream is correct to define an Icon.
and always I get the same problem or a worse one.
what ever, now I am lost in a cycle and I ask for your help may be the solution is not so complicated, but I would appreciate the replies and if someone help me to solve the problem.
thank you very much in advance
desperate Oriana
Reply
Answers (
3
)
Getting Control From FlowLayoutPanel
Error while fetching EventLog entries