为文本框制作一个计数器

编程入门 行业动态 更新时间:2024-10-10 11:26:53
本文介绍了为文本框制作一个计数器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨朋友.... 我需要制作一个计数器作为以下问题..... 如果偏差文本框得到负值然后延迟pm将计数增量偏差文本框获得正值然后待处理的pm将增加... 这是我如何找到偏差

private void dtpPM_ValueChanged( object sender,EventArgs e) { DateTime startdate = Convert.ToDateTime(dtpPM.Text.ToString()) ; DateTime enddate = Convert.ToDateTime(dtpPMCom.Text.ToString()); System.TimeSpan diffResult = startdate - enddate; txtdeviation.Text = diffResult.ToString(); }

工作正常......我需要找到 的点数例如: - 偏差= -3 延迟pm = 1 待定pm = 0 偏差= 4 延迟pm = 0 等待pm = 1 仍然我没有找到任何解决方案....请任何人帮助我... :( 谢谢

解决方案

如果你需要,请尝试以下根据时间跨度增加

如果(diffResult< 0) {延迟++; } 其他 {待定++; }

尝试 txtdeviation.Text = txtdeviation.Text - diffResult.ToString();

Hi friends.... I need to make a counter as following problem ..... if the deviation textbox get minus value then delayed pm will be count increment deviation text box gets positive value then the pending pm will be increment ... this is how I find the deviation

private void dtpPM_ValueChanged(object sender, EventArgs e) { DateTime startdate = Convert.ToDateTime(dtpPM.Text.ToString()); DateTime enddate = Convert.ToDateTime(dtpPMCom.Text.ToString()); System.TimeSpan diffResult = startdate - enddate; txtdeviation.Text = diffResult.ToString(); }

it's working fine.... I need to find the count for eg :- deviation = -3 delayed pm = 1 pending pm = 0 deviation = 4 delayed pm = 0 pending pm = 1 still I didn't find any solution.... pls anyone help me... :( thanks

解决方案

try below if you need to increment base on time span

if(diffResult <0) { delayed++; }else { pending++; }

Try txtdeviation.Text = txtdeviation.Text - diffResult.ToString();

更多推荐

为文本框制作一个计数器

本文发布于:2023-10-18 15:34:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1504645.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:计数器   文本框

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!