Add all Date and Time Formats to Listbox or Combobox using VB.NET and Higher

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
 

This will add all of the available Date and Time formats to a Listbox or Combobox control. This works for all versions of Visual Basic.NET.

 

        '
        'Should add all of the available Date and Time formats to a combobox or listbox control.
        '
        Dim dateTime As DateTime = New  _
                DateTime(Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second)

        Dim d() As String = Nothing

        d = DateTime.GetDateTimeFormats()

        ListBox.Items.AddRange(d)

 

Leave a Reply

Your email address will not be published.