C#winform实现时间自动算法

在这里插入图片描述
在这里插入图片描述
数据表存入有效时间天数后,需实现抓取当前起始时间+有效天数计算出结束时间

     private void cobGlueType_SelectedIndexChanged(object sender, EventArgs e)
        {
            string strMatType = this.cmbMatType.Text.Trim();
            
            if (this.cmbMatType.SelectedIndex >= 0)
            {
                DataTable dt = conn.GetGMRule(strMatType);
                foreach (DataRow item in dt.Rows)
                { 
                    this.cmbMatRule.Items.Add(item["RULENAME"]);
                    this.cmbVendor.Items.Add(item["GLUEVENDOR"]);
                    cmbMatRule.SelectedIndex = 0;
                    cmbVendor.SelectedIndex = 0;
                    this.dtpEndTime.Value = dtpStartTime.Value.AddDays(Convert.ToInt32(item["EFFECTIVE_DAYS"]));
                }            
            }
        }

猜你喜欢

转载自blog.csdn.net/caoguanghui0804/article/details/115089574
今日推荐