Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

"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

Posted
MyClass.GetType.Assembly

"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

Posted (edited)
Thank you, yes it works now... but why it works now ? Edited by DR00ME

"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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...