I'm creating a simple internet radio player using the windows media player control. And I want to search the users pictures folder for images and display them as a slide show in the form. This is easy but i have found that the sound becomes a little choppy when i add a timer.
I want to create a second thread that builds a timer i have my code below but it does not work.
If I dont use the thread and call the sub routine ticker it works fine, but the sound is still a little choppy
please help madaxe
I want to create a second thread that builds a timer i have my code below but it does not work.
If I dont use the thread and call the sub routine ticker it works fine, but the sound is still a little choppy
please help madaxe
VB.NET:
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim MyThread As System.Threading.Thread
MyThread = New System.Threading.Thread(AddressOf Me.Ticker)
MyThread.Start()
End Sub
Public Sub Ticker()
Dim MyTimer As New Timer
MyTimer.Interval = 100
MyTimer.Start()
AddHandler MyTimer.Tick, AddressOf DoOnTicker
End Sub
Public Sub DoOnTicker()
Dim MyBitMap(10) As Bitmap
MyBitMap(1) = DirectCast(My.Resources.Image1, Bitmap)
MyBitMap(2) = DirectCast(My.Resources.Image2, Bitmap)
MyBitMap(3) = DirectCast(My.Resources.Image3, Bitmap)
MyBitMap(4) = DirectCast(My.Resources.Image4, Bitmap)
MyBitMap(5) = DirectCast(My.Resources.Image5, Bitmap)
MyBitMap(6) = DirectCast(My.Resources.Image6, Bitmap)
MyBitMap(7) = DirectCast(My.Resources.Image7, Bitmap)
MyBitMap(8) = DirectCast(My.Resources.Image8, Bitmap)
MyBitMap(9) = DirectCast(My.Resources.Image9, Bitmap)
MyBitMap(10) = DirectCast(My.Resources.Image10, Bitmap)
ImageNumber = ImageNumber + 1
If ImageNumber = 11 Then
ImageNumber = 1
End If
PBox.Image = ResizeImage(MyBitMap(ImageNumber))
End Sub