News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Miscellaneous Forum
 
Multimedia classes in vb.net 2003 user control

Reply

by g.drost [gerritdrost at gmail dot com]
posted on 2005/12/29

okay I'm a novice vb.net 2003 programmer and this actually is my first user control in vb.net 2003, I've made some in vb6 but that's really a long time ago. I imported all the classes into the user control and wrote a little bit of code in the usercontrol which should make the usercontrol open a music file. When I try to draw this user control in a form, before the control even appears in the form it gives me a error saying: "Object reference not set to an instance of an object"... Can someone help me?

Here's the code:

Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Namespace Org.Mentalis.Multimedia

Public Class mediaplayer
Inherits System.Windows.Forms.UserControl

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'UserControl overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'mediaplayer
'
Me.Name = "mediaplayer"
Me.Size = New System.Drawing.Size(240, 180)

End Sub

#End Region
Private mediaFile As mediaFile

Private Sub mediaplayer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

CType(mediaFile, VideoFile).OutputRect = New Rectangle(0, 0, 240, 180)
LoadMusicFile()
End Sub

Private Sub LoadMusicFile()
Dim file As String = "C:\Documents and Settings\Administrator\Desktop\usbdrive backup\Music\Benny Benassi - Born To Be Alive.mp3"
If Not file Is Nothing AndAlso file <> "" Then MediaFile = New SoundFile(file)
End Sub

Private Sub LoadVideoFile(ByVal owner As IWin32Window)
Dim file As String = "C:\Documents and Settings\Administrator\My Documents\My Downloads\lambovssupra.wmv"
If Not file Is Nothing AndAlso file <> "" Then mediaFile = New VideoFile(file, owner)
End Sub

End Class

End Namespace

by car buying [4]
posted on 2007/08/18
Reply

<a href="http://wmco.org/?hair-loss-help.html ">hair loss solution</a>[url=http://wmco.org/?hair-loss-help.html]hair loss solution[/url] <a href="http://wmco.org/?cheap-used-cars.html ">cheap car rentals</a>[url=http://wmco.org/?cheap-used-cars.html]cheap car rentals[/url] <a href="http://wmco.org/?vitamins-for-hair.html ">vitamins for hair loss</a>[url=http://wmco.org/?vitamins-for-hair.html]vitamins for hair loss[/url]

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.