1. 程式人生 > >add month/year to drop-down list box

add month/year to drop-down list box

field zed etime dto bnu 格式 lis num while

add month/year to drop-down list box drop-down list添加日期 /* Add Month/Year to Card Expriry Month*/ Local Field &fld = GetField(); Local date &curDate = %Date; Local date &endDate = AddToDate(&curDate, 5, 0, 0); Local string &monYear; &fld.ClearDropDownList(); /* Local number &num = 1; While &curDate <= &endDate Local string &i = NumberToDisplayString("%", &num); &monYear = DateTimeToLocalizedString(&curDate, "MMM/y"); &fld.AddDropDownItem(&i, Rept(Char(9), &num) | &monYear); &curDate = AddToDate(&curDate, 0, 1, 0); &num = &num + 1; End-While; */ Local array of string &aryS_MthYr = CreateArrayRept("", 0); While &curDate <= &endDate /*y一定要小寫,大寫就不是"2017"這樣的格式了,暫時不知原因,求解*/ &monYear = DateTimeToLocalizedString(&curDate, "MMM/y"); &aryS_MthYr.Push(&monYear); &curDate = AddToDate(&curDate, 0, 1, 0); End-While; Local array of number &aryNbr_TabNumber = CreateArrayRept(0, 0); Local number &nbrMaxValue = &aryS_MthYr.Len; Local number &n; For &n = 1 To &aryS_MthYr.Len &aryNbr_TabNumber.Push(&nbrMaxValue); Local string &i = NumberToDisplayString("%", &n); &fld.AddDropDownItem(&i, Rept(Char(9), &aryNbr_TabNumber [&n]) | &aryS_MthYr [&n]); &nbrMaxValue = &nbrMaxValue - 1; End-For;

add month/year to drop-down list box