Hi,
I want to create a Task Scheduler, which should run when system would be started (restarted).
In that task a form (which would not be the main form) of my project should open for which I wrote the following code.
Imports System.Data.SqlClient
Public Class Alert
Dim con As SqlConnection = New SqlConnection("Data Source=.;Initial Catalog=SLIC;Integrated Security=True")
Dim cmd As SqlCommand
Dim myDA As SqlDataAdapter
Dim myDataSet As DataSet
Dim dr As SqlDataReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim todaydate As Date = Today
cmd = New SqlCommand("Select * from proposer where Date = '" & todaydate & "'", con)
If con.State = ConnectionState.Closed Then con.Open()
dr = cmd.ExecuteReader()
If dr.Read = True Then
con.Close()
My.Computer.Audio.Play("E:\Show.wav", AudioPlayMode.Background)
Else
con.Close()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
My.Computer.Audio.Stop()
End Sub
Private Sub Alert_Close(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
Application.Exit()
End Sub
End Class
You can see that it's a kind of alert system. So tell me How would I do this, or any other suggestions.
No comments:
Post a Comment