equis de
diciembre 16, 2010 a las 1:06 pm | Escrito en Uncategorized | 1 comentario‘Añade la tarea a la lista
Private Sub AnyadirRecordatorio()
Dim fila As String() = {“”, TB_Descripcion.Text, MTB_Fecha.Text, TB_Observaciones.Text}
Form1.DataGridView1.Rows.Add(fila)
Me.Close()
End Sub
‘Comprueba que los campos del formulario son correctos
Private Function ComprobarCampos() As Boolean
Dim fecha As Date
Dim camposCorrectos As Boolean = False
If TB_Descripcion.Text = “” Then
LanzarError(TB_Descripcion, “La descripción no puede estar vacía”)
camposCorrectos = False
Else
camposCorrectos = True
End If
Try
fecha = MTB_Fecha.Text
camposCorrectos = True
Catch ex As Exception
camposCorrectos = False
LanzarError(MTB_Fecha, “Debe contener una fecha válida”)
End Try
Return camposCorrectos
End Function
‘Lanza el error
Private Sub LanzarError(ByVal controlAfectads As Control, ByVal texto As String)
ErrorProvider1.BlinkRate = 1000
ErrorProvider1.SetIconAlignment(controlAfectads, ErrorIconAlignment.MiddleLeft)
ErrorProvider1.BlinkStyle = ErrorBlinkStyle.AlwaysBlink
ErrorProvider1.SetError(controlAfectads, texto)
End Sub
Private Sub tmrComprobar_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrComprobar.Tick
For Each fila As Windows.Forms.DataGridViewRow In DataGridView1.Rows
Try
If fila.Cells(1).Value < Now Then
tmrComprobar.Stop()
MsgBox(“Ha vencido una cita:” & vbCrLf & fila.Cells(1).Value & vbCrLf & fila.Cells(0).Value)
DataGridView1.Rows.Remove(fila)
tmrComprobar.Start()
End If
Catch ex As InvalidCastException
End Try
Next
End Sub
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.ShowInTaskbar = False
Else
Me.ShowInTaskbar = True
End If
End Sub
Private Sub NotifyIcon1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
Me.WindowState = FormWindowState.Normal
End Sub
Blog de WordPress.com. | Tema Pool by Borja Fernandez.
Entradas y comentarios: feeds.
