How do I calculate 365 days from the last application is started?
If I use the system. User may change it back and forth
1. What software will not work for a lock
Software should be calculated after 365 days in office have all been closed and a message will be new offices and again How do I calculate 365 days have passed and the new offices should be created?
Loading
Kunal VaishyaPosted May 3, 2012, 4:16 AM
Please try thic Procedure put this om main for load event
its also restrict of date change itvery use full
let me know
private DateTime RegDate;
private DateTime todayDate;
private void CheckLicenceAgreement()
{
try
{
//If Not Exist The Add Date Firet Time
if (Convert.ToString(Application.UserAppDataRegistry.GetValue("RegDate")) == "")
{
RegDate = DateTime.Now;
RegDate = RegDate.AddDays(15);
Application.UserAppDataRegistry.SetValue("RegDate", RegDate.ToString("yyyyMMdd"));
Application.UserAppDataRegistry.SetValue("ApplicationStart", "1");
}
else
{
//Check It
Int32 Regdt;
Int32 todt;
Regdt = Convert.ToInt32(Application.UserAppDataRegistry.GetValue("RegDate"));
todt = Convert.ToInt32(System.DateTime.Now.ToString("yyyyMMdd"));
if ((todt > Regdt) || (Convert.ToString(Application.UserAppDataRegistry.GetValue("ApplicationStart")))=="0")
{
Application.UserAppDataRegistry.SetValue("ApplicationStart", "0");
Application.Exit();
}
}
}
catch (Exception ex)
{
Application.Exit();
}
}