Ciao a tutti!
Sono nuovo nel forum (appena iscritto, anche se vi seguo da molto)
Ho davanti un piccolo dubbio, o forse meglio problema.
Ho un form con calendario che interagisce con un database (.mdb),
le opzioni del calendario sono "Inserisci" e "Indietro" (Notifiche).
Scegliendo una data, la si può inserire un testo/notifica quale appare al giorno indicato.
Il mio problema sta nel voler associare queste notifiche ad ogni singolo ID nel database.
Saprei come assocciarla ad un singolo ID, ma a tutti, ogni uno con un evento unico, no.
Qualche suggerimento?
Vi riporto il codice che ho scritto al momento (scusate se non l'commentato):
Dim m1 As MsgBoxResult
t = MonthCalendar1.SelectionRange.Start.Month.ToString & MonthCalendar1.SelectionRange.Start.Day.ToString
If Date.Today = MonthCalendar1.TodayDate And File.Exists(t & ".txt") = True Then
m1 = MsgBox("Ci sono delle notifiche. Visualizzare?", MsgBoxStyle.YesNo)
If MsgBoxResult.Yes Then
MonthCalendar1.Enabled = False
MonthCalendar1.Hide()
TextBox2.Enabled = True
TextBox2.Show()
cmdSalva.Enabled = True
cmdSalva.Show()
cmdIndietro.Enabled = True
cmdIndietro.Hide()
TextBox2.Text = File.ReadAllText(t & ".txt")
End If
End If
Dim m As MsgBoxResult
Dim t As String
Private Sub MonthCalendar1_DateSelected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected
t = MonthCalendar1.SelectionRange.Start.Month.ToString & MonthCalendar1.SelectionRange.Start.Day.ToString
Try
If File.Exists(t & ".txt") = True Then
MonthCalendar1.Enabled = False
MonthCalendar1.Hide()
TextBox2.Enabled = True
TextBox2.Show()
cmdSalva.Enabled = True
cmdSalva.Show()
cmdIndietro.Enabled = True
cmdIndietro.Show()
TextBox1.Text = File.ReadAllText(t & ".txt")
Else
m = MsgBox("Vuoi vedere le notifiche?", MsgBoxStyle.YesNo)
If m = MsgBoxResult.Yes Then
MonthCalendar1.Enabled = False
MonthCalendar1.Hide()
TextBox2.Enabled = True
TextBox2.Show()
TextBox2.Text = " "
cmdSalva.Enabled = True
cmdSalva.Show()
cmdIndietro.Enabled = True
cmdIndietro.Show()
End If
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub cmdSalva_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSalva.Click
TextBox2.Enabled = False
TextBox2.Hide()
cmdIndietro.Enabled = False
cmdIndietro.Hide()
cmdSalva.Enabled = False
cmdSalva.Hide()
MonthCalendar1.Enabled = True
MonthCalendar1.Show()
End Sub
Private Sub cmdIndietro_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdIndietro.Click
Try
If TextBox2.Text = "" Then
If File.Exists(t & ".txt") = True Then
File.Delete(t & ".txt")
End If
End If
If TextBox2.Text.Length > 0 Then
File.WriteAllText(t & ".txt", TextBox2.Text)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub