DR00ME Posted March 7, 2004 Posted March 7, 2004 Public Shared Sub Talk(ByVal WavToPlay As String) Try Dim WaveStream As Stream Dim oAssembly As Reflection.Assembly = MyClass.GetType.Assembly Dim nSpace As String = oAssembly.GetName.Name.ToString Dim WaveByteArray() As Byte WaveStream = oAssembly.GetManifestResourceStream(nSpace + "." + WavToPlay + ".wav") ReDim WaveByteArray(CInt(WaveStream.Length)) WaveStream.Read(WaveByteArray, 0, CInt(WaveStream.Length)) PlaySound(WaveByteArray, IntPtr.Zero, SND_ASYNC Or SND_MEMORY) Catch ex As Exception MsgBox(ex.ToString) End Try End Sub when I changed the sub program to PUBLIC SHARED it started to whine about "MyClass"... "Myclass is valid only within an instance method" ...when I put my baseclass name there it is whining again but this time : "reference to a non-shared member requires an object reference" ...so what should I do.... I need to use this sub proggy from a another class.... Quote "Everything should be made as simple as possible, but not simpler." "It's not that I'm so smart , it's just that I stay with problems longer ." - Albert Einstein
wyrd Posted March 7, 2004 Posted March 7, 2004 Which line is it giving you these errors on? Quote Gamer extraordinaire. Programmer wannabe.
DR00ME Posted March 7, 2004 Author Posted March 7, 2004 MyClass.GetType.Assembly Quote "Everything should be made as simple as possible, but not simpler." "It's not that I'm so smart , it's just that I stay with problems longer ." - Albert Einstein
Leaders dynamic_sysop Posted March 7, 2004 Leaders Posted March 7, 2004 you should be doing this ... [color=Blue]Dim[/color] oAssembly [color=Blue]As[/color] Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly() Quote
DR00ME Posted March 7, 2004 Author Posted March 7, 2004 (edited) Thank you, yes it works now... but why it works now ? Edited March 7, 2004 by DR00ME Quote "Everything should be made as simple as possible, but not simpler." "It's not that I'm so smart , it's just that I stay with problems longer ." - Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.