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....
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....