zsb wrote:
If I understand what you are trying to do, then something like this should work.
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = TimeOfDay bellEnabled = True For Each r As DataGridViewRow In DataGridView1.Rows Dim jam As String = Convert.ToString(r.Cells) If r.Cells("jm").Value = Label2.Text And bellEnabled = True Then 'taken from datagridview PlayBell() End If Next End Sub Sub New() Dim nmFile As String nmFile = "E:\bell1.mp3" waveOutDevice = New WaveOut(callbackInfo) mainOutputStream = CreateInputStream(nmFile) waveOutDevice.Init(mainOutputStream) End Sub Private Sub PlayBell() If waveOutDevice.PlaybackState <> Playing Then waveOutDevice.Play() End If End Sub
Sorry, I new in vb.net. I've added 'InitializeComponent()' since the code gives me warning "should call InitializeComponent method." But I still can't get it worked well. In the database I put 3 data (08:00:00, 08:20:00, and 08:40:00). The sound play well when the timer match the 1st data (08:00:00), but not for the next two data. There's no sound at all