Guest Cokegod Posted July 23, 2002 Posted July 23, 2002 I have a simple program that plays mp3's, but when i try to call my play sub, it gives me the System.NullReferenceException error. Here's The Code: (In a different Form) Dim a as form1 a.play("C:a.mp3") (In Form1) Public Sub Play(ByVal Song As String) If IsPaused Then mciSendString("RESUME " & Song, 0&, 0, 0) IsPaused = False Else mciSendString("OPEN " & Song, 0&, 0, 0) mciSendString("PLAY " & Song, 0&, 0, 0) End If End Sub Quote
Guest Cokegod Posted July 23, 2002 Posted July 23, 2002 Oh, And the error occurs at this line : a.play("C:\a.mp3") Note: Yes I made a typo in the original post and forgot the "/" Thanks Quote
*Gurus* divil Posted July 23, 2002 *Gurus* Posted July 23, 2002 You forgot to set a to an instance of the class: a = New Form1() Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
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.