VB.NET DateTimePicker - Get and Set Date


In this simple vb.net example,we see how to get and show in message box or set date using the datetimepicker vb.net component.

Public Class Form1

    Dim d As String = ""

    'GET DATE
    Private Sub retrieveBtn_Click(sender As Object, e As EventArgs) Handles retrieveBtn.Click
        d = DateTimePicker1.Value.ToString()

        MessageBox.Show(d)
    End Sub

    'SET DATE
    Private Sub setBtn_Click(sender As Object, e As EventArgs) Handles setBtn.Click
        d = "10/2/2030"
        DateTimePicker1.Value = d
    End Sub
End Class

How do You Feel after reading this?

According to scientists, we humans have 8 primary innate emotions: joy, acceptance, fear, surprise, sadness, disgust, anger, and anticipation. Feel free to tell us how you feel about this article using these emotes or via the comment section. This feedback helps us gauge our progress.

Help me Grow.

I set myself some growth ambitions I desire to achieve by this year's end regarding this website and my youtube channel. Am halfway. Help me reach them by:




Recommendations


What do You Think


Previous Post Next Post