Results 1 to 2 of 2

Thread: Entering Dates in List Boxes ??

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    9
    Hello,

    Is there any possible way that you can use an array or something like it to fill a list box with all the possible dates of the year, with just the date and month and not the year????

    (ie) having it automatically display 1st January til 31st December...without the year being shown...????

    Hope someone can help...
    Thanks,
    Andy............

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    Springfield, IL
    Posts
    124
    This code seems to work. You pass in the year that you want the dates for and it formats the date to display only the day and Month. This code puts the dates in a text box, but you can modify it to do what you are looking for I think.
    Code:
    Private Function PopulateDates(strForYear As String)
    
        Dim dtStartDate As Date
        Dim dtCurrentDate As Date
        
        dtStartDate = CDate("01/01/" & strForYear)
        dtCurrentDate = dtStartDate
        Do While strForYear = Format(dtCurrentDate, "yyyy")
            Text1.Text = Text1.Text & Format(dtCurrentDate, "dd mmm") & vbCrLf
            dtCurrentDate = dtCurrentDate + 1
        Loop
    End Function
    
    Private Sub Command1_Click()
    
        PopulateDates (2000)
    
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width