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 should get you started. You pass the year you want the dates for and it loops through putting the day and Month in a text box. you can modify the code to put the text in a listbox and format the day and month the way you want.
    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