如何在C#windows应用程序中使用过期日期。 [英] How do I use Expire date in C# windows Application.

查看:373
本文介绍了如何在C#windows应用程序中使用过期日期。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



我用C#代码开发了一个Windows应用程序。现在我需要申请到期日,这意味着我需要为第一次用户创建试用版,并且应用程序必须在到期日后关闭。



请任何人帮我解决这个问题。



先谢谢。

Dear friends,

I have Developed a Windows application using C# code. Now I need to apply Expiry date, that means I need to create trial version for the 1st time user, and The application must close after the expire date.

Please anyone help me for this problem.

Thanks in Advance.

推荐答案

如果您知道到期日期应用程序,一个想法是实现像下一个逻辑。



在您的主窗体中加载事件首先隐藏主窗体(使用 this .Hide()),然后检查当前日期(使用 DateTime.Now 属性)并将其与到期日期进行比较(使用 DateTime.CompareTo()方法);有两种可能性:

1.如果当前日期高于失效日期,您可以通知用户(通过使用 MessageBox.Show()方法)然后关闭应用程序(通过使用 this.Close())。

2.否则显示当前表单(通过使用 this.Show()方法)。
If you know the expiration date in the application, one idea is to implement a logic like the next one.

In your main form Load event first hide the main form (by using this.Hide()), then check the current date (by using DateTime.Now property) and compare it with the expiration date (by using DateTime.CompareTo() method); There are 2 possibilities:
1.If the current date is higher then the expiration date you could notify the user about this (by using MessageBox.Show() method) then close the application (by using this.Close()).
2.Otherwise show the current form (by using this.Show() method).


先生请参阅以下链接,其中包含有效的截止日期申请



Application Trial Maker [ ^ ]
sir please see the below link which contains a working expiry date application

Application Trial Maker[^]


这篇关于如何在C#windows应用程序中使用过期日期。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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