Option Explicit On
Public Class form_dia_mes
Function nombredia(ByVal
dia As Integer)
Select Case dia
Case 1 : nombredia = "Domingo"
Case 2 : nombredia = "Lunes"
Case 3 : nombredia = "Martes"
Case 4 : nombredia = "Miercoles"
Case 5 : nombredia = "Jueves"
Case 6 : nombredia = "Viernes"
Case 7 : nombredia = "Sabado"
End Select
End Function
Private Sub
Btnmostrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnmostrar.Click
Dim diaultimo, diaprimero As
Integer
Dim fecha As Date
fecha
= Microsoft.VisualBasic.DateValue(DateTimePicker1.Value)
Dim Primer As Date
Dim Ultimo As Date
Primer = DateSerial(Year(fecha), Month(fecha) + 0, 1)
Ultimo = DateSerial(Year(fecha), Month(fecha) + 1, 0)
diaprimero = Microsoft.VisualBasic.Weekday(Primer)
diaultimo = Microsoft.VisualBasic.Weekday(Ultimo)
txtultimo.Text = nombredia(diaultimo)
txtprimero.Text = nombredia(diaprimero)
Dim dia As New Date
dia =
Microsoft.VisualBasic.DateValue(DateTimePicker1.Value).ToShortDateString
dia =
dia.AddDays(-dia.Day + 1)
txtdiaprimero.Text = dia
dia =
dia.AddDays(-dia.Day + 1).AddMonths(1).AddDays(-1)
txtdiaultimo.Text = dia
End Sub
Private Sub
Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Dim salida As Integer = MsgBox("Desea
Salir?",
MsgBoxStyle.YesNo + 32, "Mensaje
al usuario")
If salida = 6 Then
Me.Close()
End If
End Sub
End Class
No hay comentarios:
Publicar un comentario