Imports GrapeCity.Viewer.Common.Model
Imports VERAG_PROG_ALLGEMEIN

Public Class frmDatumsabfrage

    Sub New()

        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()
    End Sub

    Public Datum As Date = CDate(Now.ToShortDateString)
    Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
        Label1.Text = ""

        If CDate(dtp_date.Value) > CDate(Now.ToShortDateString) Then
            Label1.Text = "Muss heute oder früher sein!"
            Me.DialogResult = DialogResult.None
            Exit Sub
        End If
        Datum = CDate(dtp_date.Value)
        Me.DialogResult = DialogResult.OK
    End Sub

    Private Sub dtp_date_KeyDown(sender As Object, e As KeyEventArgs) Handles dtp_date.KeyDown
        If e.KeyCode = Keys.Return Then
            btn.PerformClick()
        End If
    End Sub

    Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        Datum = CDate(Now.ToShortDateString)
        Me.Close()
    End Sub

    Private Sub frmDatumsabfrage(sender As Object, e As EventArgs) Handles Me.Load
        dtp_date.Value = Now.ToShortDateString
    End Sub

End Class