尝试在网格控件上循环日期2周的日期和msflexgrid问题 [英] dates and msflexgrid problem trying to loop dates on a grid control for 2 weeks

查看:50
本文介绍了尝试在网格控件上循环日期2周的日期和msflexgrid问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码,它在msflexgrid控件上为我的程序提供每周rotas的正确日期。它目前所做的是检查哪一天是星期一,并通过相应的周日,星期二等来创建日期。


现在我有一个问题,试图创建一个rota 2周而不是一个。如果我只是复制代码,它将暂时起作用,但是当那一周结束时,两个轮回只是跳过整整一周,而不是像14天那样运行。 1,2,3,4 .... 14然后将两个旋转循环到凝视15(星期一)16,17,28等。

I have this code which puts correct dates on msflexgrid control for weekly rotas on my program. What it currently does is checks which day is monday and the loops it through creating dates accordingly to as monday, tuesday etc.

now I have a problem trying to create a rota for 2 weeks instead of one. if i just copy the code it will work for the time being but as soon as that week is over both rotas just skip a whole week instead of running like 14 days. 1 , 2 , 3 , 4 .... 14 and then loop both rotas on to staring 15 (monday) 16, 17 , 28 etc.

展开 | 选择 | Wrap | 行号

推荐答案

我不确定我理解这个问题。一些示例数据会有所帮助。
I''m not sure I understand the question. Some sample data would help.


基本上我的程序从访问数据库生成rota。但是我希望自动添加日期。这就是代码的作用。要查看创建新表单并在其上添加msflexgrid控件,请将cols设置为8并将代码粘贴到表单initialize事件中。还需要将tdate声明为日期。我的问题是我想要使用一个msflexgrid控件或2来创建rota 2周。现在发生的是当日期在网格上循环时,它会在一周内自动更改。我需要在2周后才自动更改日期。如果系统日期是2月1日,我希望它循环整整14天,并且仅在2月15日更改为接下来的14天。我希望我有道理。感谢您的支持
Basically my program generates rota from access database. But I want my dates to be added automatically. Which that what the code does. To see create a new form and add msflexgrid control on it set cols to 8 and paste the code in form initialize event. Also need to declare tdate as date. My problem is I want to create rota for 2 weeks either using one msflexgrid control or 2. What happens now is when dates are looped on the grid it changes as soon as the week over automatically. I need to automatically change the dates only after 2 weeks are lapsed. If system date is 1st of Feb I want it to loop for whole14 days and only change to next 14 days on the 15th of feb. I hope I make sense. Thanks for support


我在您的代码中看不到每周后重置值的任何内容。我只看到根据当前日期设置值的代码。当一周结束时,没有任何内容可以重新运行代码。
I see nothing in your code that resets the values after each week. I only see code that sets values based on the current date. There''s nothing in there to rerun the code when a week is over.


这篇关于尝试在网格控件上循环日期2周的日期和msflexgrid问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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