Introduction
Embedded resource in a project is a new thing in .NET. This sample shows how to use it.
Using the code
The form has a button which changes the form icon.
Dim oStream As System.IO.Stream
Dim oAssembly As System.Reflection.Assembly
Dim sIcon As String
Dim oBitmap As Bitmap
If vbON Then
sIcon = "EmbeddedIconDemo.LIGHTON.ICO"
Else
sIcon = "EmbeddedIconDemo.LIGHTOFF.ICO"
End If
oAssembly = System.Reflection.Assembly.LoadFrom(Application.ExecutablePath)
oStream = oAssembly.GetManifestResourceStream(sIcon)
oBitmap = CType(Image.FromStream(oStream), Bitmap)
FetchIcon = Icon.FromHandle(oBitmap.GetHicon)
I started with VB4 in 1996, after that VB5 and VB6. Always advanced database applications (Oracle, Access and SQL-Server). The last 5 years as a technical architect and project manager for development teams.
Special interest for user interaction.