none
Combobox Date and Time Functions

    General discussion

  •  

    Hey all... how would I format or set the CurrentDate param below to return something like 12/2007 instead of the full date 12/12/2007?

     

    example:

    Dim i As Integer

    '

    Dim YearsLeft As New DateTime(2000, 1)

    YearsLeft = "1/2000"

    txtConContractExpires.Items.Add("none")

    '

    For i = i To 240

    Dim CurrentDate As New Date

    CurrentDate = FormatDateTime(DateAdd("m", i, YearsLeft), DateFormat.ShortDate)

    'CurrentDate = CurrentDate.Month & "/" & CurrentDate.Year

    txtConContractExpires.Items.Add(CurrentDate)

    Next i

    '

    txtConContractExpires.SelectedItem = "none"

     

     

    Thanks a ton!

     

    billb

     

    must need some sleep.... Smile

     

    this works...

     

    Dim i As Integer

    '

    Dim YearsLeft As New DateTime(2000, 1)

    YearsLeft = "1/2000"

    txtConContractExpires.Items.Add("none")

    '

    For i = i To 240

    Dim CurrentDate As New Date

    Dim CurrentDate2 As String

    CurrentDate = FormatDateTime(DateAdd("m", i, YearsLeft), DateFormat.ShortDate)

    'set up format to be no more than 7 chars or like 12/2000

    CurrentDate2 = CurrentDate.Month & "/" & CurrentDate.Year

    txtConContractExpires.Items.Add(CurrentDate2)

    Next i

    '

    txtConContractExpires.SelectedItem = "none"

    '

    Monday, November 19, 2007 10:55 PM