Imports System
Imports System.Drawing
Imports System.Data.OleDb
Imports System.ComponentModel
Public Class Form1
Inherits System.Windows.Forms.Form
<System.STAThread()> _
Public Shared Sub Main()
'Enable XP Styles
System.Windows.Forms.Application.EnableVisualStyles()
System.Windows.Forms.Application.Run(New Form1)
End Sub
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim Da As New OleDbDataAdapter
Dim DtTest As New DataTable("myEntries")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=db.mdb;")
cmd = New OleDbCommand("select * from myEntries", cn)
Me.Da.SelectCommand = cmd
Da.Fill(Me.DtTest)
Catch Ex As OleDbException
MessageBox.Show(Ex.Message)
Finally
cn.Close()
End Try
ShowQuote()
End Sub
Private Sub ShowQuote()
Dim Matches As Integer = 0
For Each Dr As DataRow In Me.DtTest.Rows
If CDate(Dr.Item(0)) = CDate(MonthCalendar1.SelectionRange.Start.Date) Then
TextBox1.Text = """" + Convert.ToString(Dr.Item(2)) + """"
TextBox2.Text = Convert.ToString(Dr.Item(1))
Matches += 1
End If
Next
If Matches = -1 Then
MessageBox.Show("No Entries found for selected date! ")
End If
End Sub
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = True
Me.Hide()
MonthCalendar1.SetDate(Today)
'BalloonNotification will be used to display today’s quote
InitializeTimer()
End Sub
Private Sub InitializeTimer()
Timer1.Interval = 10000 'Value to be modified by user
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'BalloonNotification will be displayed
End Sub