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)

 

One thought on “Add ‘all’ Date/Time Formats to Listbox/Combobox – VB.NET

  1. pankaj

    If rs.State = 1 Then rs.Close
    rs.Open “select max(regn_date) from customer_master”, dbcon, 2, 3
    Dim MaxDate As Date
    MaxDate = rs.Fields(0)
    Dim MaxYear As String
    MaxYear = Format(MaxDate, “yyyy”)

    in combobox in click event in coding

    Reply

Leave a Reply

Your email address will not be published.