循环时间 [英] Looping the time

查看:72
本文介绍了循环时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的程序员;


我希望缩短我的代码,在30分钟的时间间隔内在组合框上添加时间


我的示例代码

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号

解决方案

我建​​议你创建一个类型的变量日期的。将它设置为开始时间(在这种情况下,我认为是07:30)。然后使用 DateAdd()函数进行循环,添加30分钟,直到达到结束时间。每次循环时,使用 Format()函数获取所需的字符串,并将其添加到列表中。


注意,这适用于VB6,如果使用更高版本可能需要修改。


我没试过,但我只想说谢谢你的答复。如果你不介意,可以请你发给我代码:)



我没试过但我只是想说谢谢你的回复。如果你不介意,可以给我发送代码:)



在尝试自己建议的内容之前,不要求代码。


Dear programmers;

I want to shorten my codes in adding a time on a combo box with 30 mins time interval

My sample code

Expand|Select|Wrap|Line Numbers

解决方案

I''d suggest you create a variable of type Date. Set it to the start time (in this case, 07:30 I suppose). Then do a loop using the DateAdd() function to add 30 minutes, until it reaches the finish time. Each time around the loop, use the Format() function to get the string you want, and add it to the list.

Note, this applies to VB6 and may need modification if using a later version.


I did not try it but I just want to say thank you for your reply. If you won''t mind, can you please send me the codes :)


I did not try it but I just want to say thank you for your reply. If you won''t mind, can you please send me the codes :)

Further don''t ask for code before trying yourself what was suggested to you.


这篇关于循环时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆