Results 1 to 4 of 4
  1. #1
    steadyscenerio's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Posts
    22
    Reputation
    10
    Thanks
    0

    I keep getting null reference error

    Every time i run this and click the button i get a null reference error

    Code:
    Imports System****
    Imports WMPLib
    Imports AxWMPLib
    
    Public Class Form1
    
        Dim WithEvents myplayer As AxWMPLib.AxWindowsMediaPlayer
        Private Sub PlayFile(ByVal url As String)
            myplayer = New AxWMPLib.AxWindowsMediaPlayer
            myplayer.URL = ("C:\Users\JeanneSky\Documents\lalala.wma")
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            
            myplayer.Ctlcontrols.play()
    
        End Sub
    
    
    
    
    End Class

  2. #2
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Try WithEvents myplayer As NEW AxWMPLib.AxWindowsMediaPlayer.



  3. #3
    steadyscenerio's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Posts
    22
    Reputation
    10
    Thanks
    0
    I get System.Windows.Forms.AxHost+InvalidActiveXStateExc eption on myplayer.Ctlcontrols.play() fml i might use direct sound

    because I heard there the same execpt direct sound is harder
    Last edited by steadyscenerio; 10-02-2012 at 02:37 AM.

  4. #4
    steadyscenerio's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Posts
    22
    Reputation
    10
    Thanks
    0
    Alright Im now trying to use System.Media.SoundPlayer its playing perfect but I play lalala.wav and when i play GA005.wav they dont play spontaneously how can i do this maybe using this with mciSendString API somehow?

    module1
    Code:
    Module Module1
        Private PlaySound As New System.Media.SoundPlayer
        Private kick As New System.Media.SoundPlayer
        Public Sub PlaySoundFile(ByVal SoundPath As String)
            PlaySound.SoundLocation = SoundPath
            PlaySound.Load()
            PlaySound.Play()
        End Sub
        Public Sub kickfile(ByVal SoundPath As String)
            kick.SoundLocation = SoundPath
            kick.Load()
            kick.Play()
        End Sub
    End Module

    form1
    Code:
    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
        End Sub
      
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            kickfile("C:\Users\JeanneSky\Desktop\leo\Sounds\drumkit\KICK\GA005.wav")
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            PlaySoundFile("C:\Users\JeanneSky\Desktop\lalala.wav")
        End Sub
    End Class

Similar Threads

  1. Keep getting the codesign errors.
    By pilotberry in forum iOS
    Replies: 7
    Last Post: 11-21-2011, 01:54 AM
  2. Help me, i keep getting errors...
    By sdefref in forum Combat Arms Help
    Replies: 8
    Last Post: 01-13-2010, 03:32 AM
  3. I keep getting error when opening hack[HELP!!!!!!]
    By Cagamer in forum Combat Arms Hacks & Cheats
    Replies: 18
    Last Post: 12-18-2008, 09:19 PM
  4. Keep Getting Error Code
    By Promisetime in forum Combat Arms Hacks & Cheats
    Replies: 15
    Last Post: 08-14-2008, 04:48 PM
  5. help i keep getting this error
    By <sniper> in forum Hardware & Software Support
    Replies: 0
    Last Post: 10-29-2007, 05:13 PM