Mp3 Player : Mp3 Player « Windows « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Windows » Mp3 Player 
24.24.1.Mp3 Player
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms

public class Mp3Player
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class

Public Class Form1
    Inherits System.Windows.Forms.Form

    Public Sub New()
        MyBase.New()

        InitializeComponent()

    End Sub

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    Private components As System.ComponentModel.IContainer

    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents AxMediaPlayer1 As AxMediaPlayer.AxMediaPlayer
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Button4 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
        Me.AxMediaPlayer1 = New AxMediaPlayer.AxMediaPlayer
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button3 = New System.Windows.Forms.Button
        Me.Button4 = New System.Windows.Forms.Button
        CType(Me.AxMediaPlayer1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'AxMediaPlayer1
        '
        Me.AxMediaPlayer1.Location = New System.Drawing.Point(888)
        Me.AxMediaPlayer1.Name = "AxMediaPlayer1"
        Me.AxMediaPlayer1.OcxState = CType(resources.GetObject("AxMediaPlayer1.OcxState"), System.Windows.Forms.AxHost.State)
        Me.AxMediaPlayer1.Size = New System.Drawing.Size(8864)
        Me.AxMediaPlayer1.TabIndex = 0
        Me.AxMediaPlayer1.Visible = False
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(4080)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(5632)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "Open"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(9680)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(5632)
        Me.Button2.TabIndex = 2
        Me.Button2.Text = "Play"
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(15280)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(5632)
        Me.Button3.TabIndex = 3
        Me.Button3.Text = "Pause"
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(20880)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(5632)
        Me.Button4.TabIndex = 4
        Me.Button4.Text = "Stop"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(292142)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.AxMediaPlayer1)
        CType(Me.AxMediaPlayer1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles Button1.Click
        OpenFileDialog1.ShowDialog()
        OpenFileDialog1.Filter = "MP3 Files(*.mp3)|*.mp3|MIDI(*.mid)|*.mid|All Files(*.*)|*.*"
        OpenFileDialog1.FilterIndex = 1
        AxMediaPlayer1.Open(OpenFileDialog1.FileName)
        Button2.Enabled = True
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles Button2.Click
        AxMediaPlayer1.Play()
        Button3.Enabled = True
        Button4.Enabled = True
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles Button3.Click
        AxMediaPlayer1.Pause()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles Button4.Click
        AxMediaPlayer1.Stop()
        Button3.Enabled = False
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgsHandles MyBase.Load
        Button2.Enabled = False
        Button3.Enabled = False
        Button4.Enabled = False
    End Sub

End Class
24.24.Mp3 Player
24.24.1.Mp3 Player
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.