我有一个关于Asp.net的问题 [英] I have a Question regarding Asp.net

查看:74
本文介绍了我有一个关于Asp.net的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了三个文本框.一是登录时间.另一个是注销时间.另一个是总时间.如果我要输入登录时间和注销时间,它将如何自动显示总时间.

ihave taken three textbox. one is login time. another is logout time.and another is total time.if i will insert the login time and logout time ,how automaticaly it will show the total time.

推荐答案

这里是一种可能的解决方案:
Here is one possible solution:
private void UpdateTotalTime()
{
  DateTime timeStart;
  DateTime timeEnd;
  if (DateTime.TryParse(textBox1.Text, out timeStart) && DateTime.TryParse(textBox2.Text, out timeEnd))
  {
    TimeSpan span = (timeEnd - timeStart);
    textBox3.Text = span.ToString("c");
  }
}


当两个输入文本框中的文本发生更改时,只需调用此函数即可.


Just call this function when the text in your two input textboxes changes.


请参阅此....
http://forums.asp.net/t/1725438.aspx/1 [ ^ ]
如何计算两个texbox之间的总时间? [ ^ ]
http://www.dotnetspider.com/Forum/244478-Asp.net-with-c-calculate-totaltime-with-starttime-endtime.aspx [
please refer this....
http://forums.asp.net/t/1725438.aspx/1[^]
how to count total time between two texboxes?[^]
http://www.dotnetspider.com/forum/244478-Asp.net-with-c-calculate-totaltime-with-starttime-endtime.aspx[^]


这篇关于我有一个关于Asp.net的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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