我需要知道如何编码以在标签或文本框中显示按钮单击时间(系统时间)。 [英] I Need to know how to code to display the button click time(systemtime) in a label or textbox.

查看:104
本文介绍了我需要知道如何编码以在标签或文本框中显示按钮单击时间(系统时间)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,任何人都可以帮助我实现上述目标。



实际上我正在开发一个包含按钮和标签的Web应用程序我想要的是当我点击按钮时,它应该显示发生点击的时间。



例如:



如果我点击标签中的button1它应显示为



最后点击发生在3-7-2014 5:13 PM



<大>

如何在Textview中显示








提前致谢..

Hi can any one help me to achieve the above mentioned thing.

Actually i'm developing an web application which contains button and an label what i want is when ever i click on the button it should display the time of the click that takes place.

For Eg:

if i click the button1 in label it should display as

Last Click takes place at 3-7-2014 5:13 PM


How to display in Textview




Thanks in advance..

推荐答案

试试这段代码

Try this code
protected void Button1_Click(object sender, EventArgs e)
    {
      Label1.Text=DateTime.Now.ToString();
    }


试试这个



Button_Click(...)

{

txtbox.Text =最后点击发生在+ DateTime.Now.Tostring();

}
try this

Button_Click(...)
{
txtbox.Text="Last Click takes place at "+DateTime.Now.Tostring();
}


您好



以下代码解决了我的问题。





TextView tv =(TextView)findViewById(R.id.textView1);

Date cal =(Date)Calendar.getInstance()。getTime();

date = cal.toLocaleString();

tv.setText(date.toString());
Hi

The below code solved my problem.


TextView tv = (TextView) findViewById(R.id.textView1);
Date cal = (Date) Calendar.getInstance().getTime();
date = cal.toLocaleString();
tv.setText(date.toString());


这篇关于我需要知道如何编码以在标签或文本框中显示按钮单击时间(系统时间)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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