Click here to Skip to main content
15,912,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
Posted
Updated 7-Mar-14 1:42am
v2

Try this code
C#
protected void Button1_Click(object sender, EventArgs e)
    {
      Label1.Text=DateTime.Now.ToString();
    }
 
Share this answer
 
Comments
[no name] 7-Mar-14 6:51am    
Thanks for the quick replay i'l try it.
try this

Button_Click(...)
{
txtbox.Text="Last Click takes place at "+DateTime.Now.Tostring();
}
 
Share this answer
 
v3
Comments
[no name] 7-Mar-14 6:52am    
Thanks alot will try your method....
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());
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900