Problems on class writing?
Hello!
I want to write a class that can get the System time, but why I can't call it from my next Windows Form class?
using System;
namespace ClassTester
{
///
/// Summary description for TimeStamp.
///
public class TimeStamp
{
public TimeStamp()
{
//
// TODO: Add constructor logic here
//
}
public string TClock()
{
string TimeInString="";
int hour=DateTime.Now.Hour;
int min=DateTime.Now.Minute;
int sec=DateTime.Now.Second;
TimeInString=(hour < 10)?"0" + hour.ToString() :hour.ToString();
TimeInString+=":" + ((min<10)?"0" + min.ToString() :min.ToString());
TimeInString+=":" + ((sec<10)?"0" + sec.ToString() :sec.ToString());
return TimeInString;
}
}
}
Please give me reply asap. Thanks!