|
-
Sep 10th, 2004, 04:30 PM
#1
Thread Starter
New Member
Problem With Embedded Resources Inside A user Control
HI all!
When designing a control, i embedded some pictures into the project.
But when i try to access them i get no joy!
the thing is the code i use works fine on just a standard project, but when i try it in the control, no stream is returned!
The namespace im using is correct, and ive even tried putting the resourses in both the usercontrol project and the test project!
Heres the code i use for standard projects:
Public Function GetEmbeddedImage(ByVal AppForm As Object, ByVal strImageName As String) As Bitmap
Dim Exec_Assem As [Assembly] = AppForm.GetType.Assembly.GetEntryAssembly
Dim myNameSpace As String = Exec_Assem.GetName.Name.ToString
Dim PicStream As Stream
Dim BMP As Bitmap
PicStream = Exec_Assem.GetManifestResourceStream(myNameSpace + "." + strImageName)
BMP = New Bitmap(PicStream)
GetEmbeddedImage = BMP.Clone()
BMP.Dispose()
PicStream.Close()
End Function
the only differnce in code i use when calling from the usercontrol is :
GetEntryAssembly
Instead of which i use
GetExecuting Assembly , as this returns the user control assembly instead of the test project assembly.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|