Tag Archives: datetime

Add ‘all’ Date/Time Formats to Listbox/Combobox – VB.NET

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 control or to a 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()

        ListBox1.Items.AddRange(d)

 

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)