Time and combo box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bfg
    New Member
    • Apr 2006
    • 1

    #1

    Time and combo box

    Can any one help me im trying to populate a combo box in vb6 with the time form 0 hours to 24 hours for the hole day so wood say it in hh:mm.
    thanks
  • Pragash
    New Member
    • Feb 2007
    • 3

    #2
    Try "format" function to change the formats of time,date or numbers

    combobox name is "cboTime"

    For i = 0 to 24
    cboTime.additem format(ctime(i) ,"hh:mm")
    Next

    may be it show the error in "ctime", if it is show the error remove the ctime and just put "i"

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      You could try this one, as well...
      Code:
      Dim TheTime As Date, I As Long
      TheTime = TimeValue("00:00")
      For I = 1 To 1440
        cboTime.AddItem Format(TheTime, "hh:nn")
        TheTime = DateAdd("n", 1, TheTime)
      Next
      cboTime.Text = "00:00"

      Comment

      Working...