473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

30 days expiry

6
Hello,

How to add 30 days expiry in a vb.net application ?
Pls give me the code.

Thanks,
Pratip
Oct 23 '06 #1
1 1265
xtab
6
There are several ways of doing this. Some more secure than others . Here is a simple way which will work in basic circumstances but is not secure enough for a commercial app.

Create an Application Setting via Project - Properties - Settings. Name it StartDate, give it Application scope and set it to today's date.

In your code put this in the Load event of the startup form:

Expand|Select|Wrap|Line Numbers
  1. Dim d As Date = Today
  2.         Dim d2 As Date = My.Settings.StartDate
  3.         If d.Subtract(d2).TotalDays > 30 Then
  4.             MessageBox.Show("Expired")
  5.             Application.Exit()
  6.         End If
  7.  
  8. '  OR
  9.         ' Shorter version:
  10.         If Today.Subtract(My.Settings.StartDate).TotalDays > 30 Then
  11.             MessageBox.Show("Expired")
  12.             Application.Exit()
  13.         End If
Oct 24 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Hardeep Rakhra | last post by:
Hi i have a snippet of JS that i want to change so that the cookie it creates lasts only 48 hours. (or any other length of time i decide, but 48hours seems right for now) Only thing i can't...
4
by: ianv2 | last post by:
Hi Is the following possible using Javascript ? I would like a page to redirect to another page if the page expiry has passed. E.G. If my questionnaireform.html page had an expiry date...
6
by: carl.barrett | last post by:
Hi, I have a continuous form based on a query ( I will also be creating a report based on the same query). There are 2 fields: Date Obtained and Date Of Expiry I want a further 3 columns...
3
by: hasanainf | last post by:
Hi all, What will be the best database design for an inventory control that uses expiry date for its products. Over a period of time, a particular product will have many expiry date and that...
6
by: mymatebob | last post by:
Hi, I am using cookies to keep track if a user is logged into my system, and would like to display the time that the user has left logged in. One solution is to display the time left until the...
0
by: kuldeep singh sethi | last post by:
Hi All, How to add 5 days expiry in a C# web application (Login Page)? Pls give me the code. And also how to add Cookies for checkbox e.g. "Remember Me". Thanks Kuldeep Singh Sethi
0
by: kuldeep singh sethi | last post by:
Hi All, How to add 5 days expiry in a C# web application (Login Page)? Pls give me the code. And also how to add Cookies for checkbox e.g. "Remember Me". Thanks Kuldeep Singh Sethi
1
by: Shazia Sadiq | last post by:
I am registering persons for free upto to 2 months but i want to send a email to person 5 days befor that expiry data meet. Is their any auto process that mysql server could perform if yes than how...
0
by: mplpost | last post by:
We have created a Certificate for the purpose of symmetric encryption. We did not mention the expiry date explicitly, only later we found out that, if expiry date not mentioned then the default...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.