469,270 Members | 1,531 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

how add time from 00:00:00 to 23:59:00 to a combo box as items

seshu
156 100+
Hi everybody
This is seshu i have small doubt in adding times to a combobox
form 00:00:00 to 23:00:59 because there are two comboboxes in my table and i want to use them as from time to to time
please some one of help me out
regards
seshu
Jan 27 '07 #1
4 1747
Killer42
8,435 Expert 8TB
Hi everybody
This is seshu i have small doubt in adding times to a combobox
form 00:00:00 to 23:00:59 because there are two comboboxes in my table and i want to use them as from time to to time
please some one of help me out
First, you might want to consider using a DateTimePicker control rather than a combobox. Doing it your way, each combobox will have 86,400 entries. Is that possible?

But if you're determined to load them up that way, it should be fairly simple. What about the following. (Sorry, I usually check code in VB as I go, but my PC is having problems and VB won't run so I'll just type it straight out here.)
Expand|Select|Wrap|Line Numbers
  1. Dim TheTime As Date,StartTime As Date
  2. TheTime = TimeValue("00:00:00") ' (I think TimeValue is the right function)
  3. StartTime=TheTime
  4. Do
  5.   ComboBox.Add Format(TheTime, "hh:nn:ss")
  6.   TheTime = DateAdd("s", 1, TheTime
  7. Loop Until Day(TheTime) <> Day(StartTime)
  8.  
Jan 27 '07 #2
seshu
156 100+
will this work for time i dont think so
if possible be some more clear
please sir
Jan 29 '07 #3
seshu
156 100+
sorry sorry its working and iam also able to make chages to code
Jan 29 '07 #4
Killer42
8,435 Expert 8TB
sorry sorry its working and iam also able to make chages to code
Glad to hear it.

When we refer to a "date" value in VB (or VBA, or Access) it quite often contains both date and time information. Can be a bit confusing at times.
Jan 29 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Shaun | last post: by
3 posts views Thread by Jan Schmidt | last post: by
6 posts views Thread by Kenneth | last post: by
19 posts views Thread by Bjørn T Johansen | last post: by
reply views Thread by Ed Bick | last post: by
6 posts views Thread by mesut | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.