473,387 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Creating ICON no through the properties

Hi,

I want to add icon to my form (on the left corner of the form, where the fom
text is), but i can't use the property window. how can i do it through the
code?

my Icon path now is d:\temp. when i'll finish my project and take the *.exe
file and put it on a different computer, do i have to put my icon file too or
does it complied into the exe file?

Thanks,
Gidi.
Nov 17 '05 #1
5 2596
Gidi,

You could place it in the resources for the exe.

If you know that it isn't going to change, then it is better to set it
as a resource for your exe, and then get it from there.

If you have a need to load it from disk, you can just call the static
GetEntryAssembly method on the Assembly class. This will give you the entry
point for your program. Once that is done, you can get the Location
property to find out where your assembly is on disk, and then load your
icon, and set the property on the form.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:48**********************************@microsof t.com...
Hi,

I want to add icon to my form (on the left corner of the form, where the
fom
text is), but i can't use the property window. how can i do it through the
code?

my Icon path now is d:\temp. when i'll finish my project and take the
*.exe
file and put it on a different computer, do i have to put my icon file too
or
does it complied into the exe file?

Thanks,
Gidi.

Nov 17 '05 #2
Hello Nicholas,

Thanks.

What i want is, that all my forms will have the same ICON or there left
corner (this icon isn't going to change), how can i place it in the resources
for the exe?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Gidi,

You could place it in the resources for the exe.

If you know that it isn't going to change, then it is better to set it
as a resource for your exe, and then get it from there.

If you have a need to load it from disk, you can just call the static
GetEntryAssembly method on the Assembly class. This will give you the entry
point for your program. Once that is done, you can get the Location
property to find out where your assembly is on disk, and then load your
icon, and set the property on the form.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:48**********************************@microsof t.com...
Hi,

I want to add icon to my form (on the left corner of the form, where the
fom
text is), but i can't use the property window. how can i do it through the
code?

my Icon path now is d:\temp. when i'll finish my project and take the
*.exe
file and put it on a different computer, do i have to put my icon file too
or
does it complied into the exe file?

Thanks,
Gidi.


Nov 17 '05 #3
Gidi,

If you set the icon to a file on disk, the designer will automatically
place it in a resource file and then load it from that.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:22**********************************@microsof t.com...
Hello Nicholas,

Thanks.

What i want is, that all my forms will have the same ICON or there left
corner (this icon isn't going to change), how can i place it in the
resources
for the exe?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Gidi,

You could place it in the resources for the exe.

If you know that it isn't going to change, then it is better to set
it
as a resource for your exe, and then get it from there.

If you have a need to load it from disk, you can just call the static
GetEntryAssembly method on the Assembly class. This will give you the
entry
point for your program. Once that is done, you can get the Location
property to find out where your assembly is on disk, and then load your
icon, and set the property on the form.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:48**********************************@microsof t.com...
> Hi,
>
> I want to add icon to my form (on the left corner of the form, where
> the
> fom
> text is), but i can't use the property window. how can i do it through
> the
> code?
>
> my Icon path now is d:\temp. when i'll finish my project and take the
> *.exe
> file and put it on a different computer, do i have to put my icon file
> too
> or
> does it complied into the exe file?
>
> Thanks,
> Gidi.


Nov 17 '05 #4
Nicholas,

I'm sorry, but i don't understand the meaning. do you mean by setting the
icon to a file on disk, that i need to change the icon property in my Form?
becuase as i said, i can't enter the designer mode, i have to do it from the
code, can you please give me an example?

Sorry for nagging,
Gidi.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Gidi,

If you set the icon to a file on disk, the designer will automatically
place it in a resource file and then load it from that.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:22**********************************@microsof t.com...
Hello Nicholas,

Thanks.

What i want is, that all my forms will have the same ICON or there left
corner (this icon isn't going to change), how can i place it in the
resources
for the exe?

"Nicholas Paldino [.NET/C# MVP]" wrote:
Gidi,

You could place it in the resources for the exe.

If you know that it isn't going to change, then it is better to set
it
as a resource for your exe, and then get it from there.

If you have a need to load it from disk, you can just call the static
GetEntryAssembly method on the Assembly class. This will give you the
entry
point for your program. Once that is done, you can get the Location
property to find out where your assembly is on disk, and then load your
icon, and set the property on the form.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:48**********************************@microsof t.com...
> Hi,
>
> I want to add icon to my form (on the left corner of the form, where
> the
> fom
> text is), but i can't use the property window. how can i do it through
> the
> code?
>
> my Icon path now is d:\temp. when i'll finish my project and take the
> *.exe
> file and put it on a different computer, do i have to put my icon file
> too
> or
> does it complied into the exe file?
>
> Thanks,
> Gidi.


Nov 17 '05 #5
Gidi,

If that is the case, then you can reference my previous post, which
refers you to the GetEntryAssembly method on the Assembly class.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:D8**********************************@microsof t.com...
Nicholas,

I'm sorry, but i don't understand the meaning. do you mean by setting the
icon to a file on disk, that i need to change the icon property in my
Form?
becuase as i said, i can't enter the designer mode, i have to do it from
the
code, can you please give me an example?

Sorry for nagging,
Gidi.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Gidi,

If you set the icon to a file on disk, the designer will
automatically
place it in a resource file and then load it from that.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:22**********************************@microsof t.com...
> Hello Nicholas,
>
> Thanks.
>
> What i want is, that all my forms will have the same ICON or there left
> corner (this icon isn't going to change), how can i place it in the
> resources
> for the exe?
>
> "Nicholas Paldino [.NET/C# MVP]" wrote:
>
>> Gidi,
>>
>> You could place it in the resources for the exe.
>>
>> If you know that it isn't going to change, then it is better to
>> set
>> it
>> as a resource for your exe, and then get it from there.
>>
>> If you have a need to load it from disk, you can just call the
>> static
>> GetEntryAssembly method on the Assembly class. This will give you the
>> entry
>> point for your program. Once that is done, you can get the Location
>> property to find out where your assembly is on disk, and then load
>> your
>> icon, and set the property on the form.
>>
>> Hope this helps.
>>
>>
>> --
>> - Nicholas Paldino [.NET/C# MVP]
>> - mv*@spam.guard.caspershouse.com
>>
>> "Gidi" <sh*****@hotmail.com.dontspam> wrote in message
>> news:48**********************************@microsof t.com...
>> > Hi,
>> >
>> > I want to add icon to my form (on the left corner of the form, where
>> > the
>> > fom
>> > text is), but i can't use the property window. how can i do it
>> > through
>> > the
>> > code?
>> >
>> > my Icon path now is d:\temp. when i'll finish my project and take
>> > the
>> > *.exe
>> > file and put it on a different computer, do i have to put my icon
>> > file
>> > too
>> > or
>> > does it complied into the exe file?
>> >
>> > Thanks,
>> > Gidi.
>>
>>
>>


Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Matthew Fitzpatrick | last post by:
when multiple similar forms are opened up, windows xp can group them into an application group button on the start bar. Unfortunately, this application group uses the icon of the application's...
8
by: Adrian | last post by:
How do I put an icon on a form using code? Thank you.
5
by: WRH | last post by:
Hello This must be on a faq somewhere but despite a lot of googling I still can't resolve this issue: I have a C# app and I would like to see its icon displayed when the exe file is viewed in...
7
by: Just D. | last post by:
All! Who knows how can I change the form image (left top corner)? I can add bmp and ico images as resources to the Windows Application Project and if I create a link on the desktop I see this...
6
by: Paul | last post by:
In other development environments i've used the IDE had facilities to create custom icons for the application and files it created. It would be nice to have a custom icon for a created file, but...
2
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
5
by: IcingDeath via DotNetMonster.com | last post by:
I am building this SQL Server database app in which i can store files. In order to display files I want to have the app show the associated icon for the extension of the file that is in the...
2
by: John Dann | last post by:
I'm struggling to add an icon to my VB2005 program. I've pointed to the icon I want to use in Project | Properties, the icon itself appears alongside the icon path and the icon file has been copied...
4
by: Marcolino | last post by:
Hi, I have simple needs but I don't know how to implement it. I have application that create Dynamic Button. I need to set the image on this button, getting the icon from a form. So pratically...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.