单击按钮时如何使数字显示在文本框中? [英] How do I get numbers to display in a text box when I click a button?

查看:88
本文介绍了单击按钮时如何使数字显示在文本框中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C#的新手,我正在为修改后的预警评分系统(MEWS)构建Windows窗体,该窗体已在医院中用于监视患者的健康状况.我已经为此构建了一个GUI,但是我不确定要使用什么代码才能使其正常工作.我使用计时器在屏幕上移动彩色标签,以代表患者的生命体征.例如,输入的呼吸频率为

Im new to c# and im building a windows form for the Modified early warning scoring system (MEWS) which is used in hospitals to monitor a patients health. I have built a GUI for it, but im not sure what code to put in to get it to work. Im using timers to move coloured labels across the screen to represent a patient vital signs. So for example the Respiration rate ive put in is

tmrResps.Enabled = true; tmrResps.Interval = 2000;



我只用一个按钮启动计时器,就可以正常工作了.但是我接下来要做的是根据该生命体征计时器的输出显示分数.我要使用按钮,当按下这些按钮时,分数将在文本框中显示.我想知道的是我用什么代码来完成这项工作?



Ive but a button in which starts the timers and this works fine. But what I want to do next is show a score based on the output of that vital sign timer. I want to use buttons which when pressed will display the score in a text box. What I want to know is what code do i use to make this work?

推荐答案

Hello Max,

创建一个名为-ArrayList alCountHeartRate = new ArrayList();
的全局字段
每个心律-您需要使用Random()来打破每次心跳的恒定2秒间隔-使其在日常工作中发生偏离.
含义选择一个介于1到2000之间的随机值作为计时器的毫秒数.

对于计时器的每个Tick()事件,请在Arraylist中添加1个条目,其中包含计时器的实际值. (0-2000)

当用户单击按钮以显示结果时.
对结果的值的ArrayList内容执行平均值.

问候,
X
Hello Max,

Create a global field called - ArrayList alCountHeartRate = new ArrayList();

with each heart rate - you need to use Random() to break the constant 2 second intervals per heart beat - so that it deviates in routine.
Meaning select a random value between 1 - 2000 for the timer''s milliseconds.

With each Tick() event of your timer - add 1 entry to the Arraylist with the actual value of the timer elapsed value. (0-2000)

when the user clicks the button to display results.
Do a Average with the ArrayList content of values for the result.

Regards,
X


这篇关于单击按钮时如何使数字显示在文本框中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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