473,378 Members | 1,523 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,378 software developers and data experts.

VB.Net - Setting all form icons to the application icon

Is their a way in a VB.Net application to set all sub form icons to the main
form ? or even set all icons to the Application icon, without having to
reference the icon as a filename ?

With Thanks

Jason
Nov 21 '05 #1
3 21346
Jason,

This answer is so not only for the icons.

Create your own basic form with everything basicly on it, and create from
that inherited forms. (That is an item in the add items in the project
explorer)

I hope this helps,

Cor
Nov 21 '05 #2
"QLD_AU" <Ne**@DigitalSniper.Net> schrieb:
Is their a way in a VB.Net application to set all sub form icons to the
main form ? or even set all icons to the Application icon, without having
to reference the icon as a filename ?


There are different ways to do that:

* You can assign the icon to all forms at designtime.

* You can create a base form that includes the icon and let
all other forms inherit from this base form.

* You can make a reference to the icon or main form available
and assign the icon at runtime, for example, in the forms' constructors:

Providing a reference to an application's main form
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=accessmainform&lang=en>

<URL:http://groups.google.de/groups?selm=OyzrpoUCFHA.392%40TK2MSFTNGP14.phx.gbl >

It's not recommended to assign icons to all forms of an application.
Especially dialogs (forms which are shown modally) typically don't have an
icon at all. Take a look at Microsoft's applications to see when using an
icon in the form's title bar makes sense.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Bob
Just in case this might help you managing icons...

Add some icons to your project, make them embedded resources, then put their
file names in the enum below. Then you can access them easily like so:

Dim i As Icon = Resources.GetIcon(Icons.IconName1)

Watch for line breaks...

------BEGIN CODE-------

Imports System.Reflection

Public Class Resources

Private Sub New()
End Sub

Public Enum Icons
IconName1
IconName2
IconName3
End Enum

Private Shared RootNameSpace As String = GetType(Resources).Namespace

Public Shared Function GetIcon(ByVal Icon As Icons) As Icon
Dim ret As Icon
Dim asm As [Assembly] = [Assembly].GetExecutingAssembly
Dim Name As String = _
RootNameSpace & "." & System.Enum.GetName(Icon.GetType, Icon) &
".ico"
Dim s As System.IO.Stream = asm.GetManifestResourceStream(Name)
If Not s Is Nothing Then
ret = New Icon(s)
s.Close()
End If
Return ret
End Function

End Class

------END CODE-------

"QLD_AU" <Ne**@DigitalSniper.Net> wrote in message
news:42********@duster.adelaide.on.net...
Is their a way in a VB.Net application to set all sub form icons to the main form ? or even set all icons to the Application icon, without having to
reference the icon as a filename ?

With Thanks

Jason

Nov 21 '05 #4

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

Similar topics

3
by: Will Mathies | last post by:
I have changed the icon used for my C# windows form application. Now I am having problems. When my app has several windows open they get grouped on the taskbar. The icon that this group uses is...
3
by: Wayne | last post by:
I currently have an app whose Icon I am setting. I want to set the icons in my forms at run time to that of the application icon. How do I retrieve the application Icon so that I can use it for my...
2
by: Elad Gutman | last post by:
Hi Everyone, I'm facing an annoying problem and any help will be most appreciated . .. . I have a main application form and its icon is functioning excellent: it appears both in the taskbar...
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...
1
by: quest | last post by:
I created windows application using C#. I tried to replace the default application icon by replacing the app.ico file in the project directory but the application still load the old icon. Can...
0
by: Dick | last post by:
I have a shared project that contains icons and bitmaps that are used throughout my suite of applications. I have to set Form.Icon, PictureBox.Image, etc. using code because the form designer...
1
by: KK | last post by:
I have a C# application with different projects in the solution. I need to change the application icon based on build configuration. I have different build configurations for branding the...
1
by: Avnish | last post by:
Hi, I have created an form based application in c# having some GUI. I have also added localization support to it due to GUI changes for different customers.Now the issue I have the Application...
1
by: sfirouz | last post by:
Hi: I am new to .net stuff and to make the matter worst, I am converting from Borland to Microsoft world. So I am having real hard time figuring things out in VC++ .net. (I am using VS 2008) ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...

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.