VB.NET - Working with Assemblies



Retrieve a Text File from an Assembly's Resources

'Namespace: System.IO
'Namespace: System.Reflection
'Namespace: Microsoft.VisualBasic

'File Name: "Syntaxhelp.scripts.txt"

Dim executingAssembly As Assembly = Assembly.GetExecutingAssembly
Dim appStream As Stream = executingAssembly.GetManifestResourceStream("Syntaxhelp.scripts.txt")
Dim textStream As New StreamReader(appStream)
Dim text As String = textStream.ReadToEnd

Retrieve an Image that Is an Application Resource

'Reference: System.Windows.Forms.dll
'Namespace: Microsoft.VisualBasic

'Picutre box Name: pctSyntaxhelp
'Image Name: imgLogo

pctSyntaxhelp.Image = My.Resources.imgLogo

Load an Assembly at Run Time

'Namespace: System.Reflection
'Namespace: Microsoft.VisualBasic

'AssemblyName: C:\Folder\syntaxhelp.dll

Dim asmbly AS Assembly = Assembly.LoadFile("C:\Folder\syntaxhelp.dll")

Load a Cursor File from an Assembly

'Assembly: System.Windows.Forms.dll
'Namespace: System.Reflection
'Namespace: System.Windows.Forms
'Namespace: Microsoft.VisualBasic

Dim newCursor As New Cursor(My.Resources.ResourceManager.GetStream("syntaxhelpCursor"))
Me.Cursor = newCursor

Find the Names of Resources in an Assembly

'Namespace: System.Reflection
'Namespace: Microsoft.VisualBasic

Dim asmbly AS Assembly = Assembly.GetExecutingAssembly()
Dim resources() As string = asmbly.GetManifestResourceNames

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.