我需要一些关于如何完成我尝试做的事情的想法,这是场景。
我有2个DateTimePickers(DateTimePicker1和DateTimePicker2)作为日期范围。我需要一个函数:
1.) Download a file from my ftp with the initial date/time in yyyyMMdd.txt format
2.) Add 1 to the date and do the download again until DateTimePicker1 = DateTimePicker2
3.) If the file doesn't exist (its possible it may not), just move on to the next date.
我成功创造了一个无限循环!它只是不会重复。我不熟悉Do While循环,所以任何提示都是weclomed!
我尝试过类似的事情:
While DateTimePicker1 < DateTimePicker2
Do My.Computer.Network.FileDownload("ftp://address/", "ftp://address/" & folder & "/" & DateTimePicker1 & ".txt")
DateTimePicker1.Value.AddDays(1)
Loop
答案 0 :(得分:1)
我认为您需要比较Value
的{{1}}属性,当您调用DateTimePicker
时,您必须将结果分配回AddDays()
属性,如下所示:
Value
DateTimePicker1.Value = DateTimePicker1.Value.AddDays(1)
属性是Value
对象,DateTime
会返回AddDays()
个对象。
所以试试这个......
DateTime
这是一个只有DateTime对象的Fiddle Demo。