Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i made a c# application with product key facility and there are two forms one is named "ProductKey" and another one is "Home" .

when i run this form then it go to product key page and after verification of product key it go to home page and when i re-run this application it again show the product key page.
but i want that after verification of product key when i re-run this application then it will directly go to home page.
Posted
Updated 1-Dec-15 0:56am
v2
Comments
BillWoodruff 1-Dec-15 8:49am    
You need to clarify:

1. first time run: go to product key form ... enter key ? you write the key to the local machine ? then goes to application

2. second time run: shows product key form ... why ? what does the user do here ?

3. third and other runs: application checks for valid product key and then goes directly to main form ?

every application has an entry point - in case of Windows Form Application this is the Main method...
You have somewhere in your code code like this:
C#
static void Main ( )
{
  // some code here
  Application.Run( new ProductKey( ) );
}

At this point you should do these:
1. Check if you already has a valid product key (from registry/web service/config file)
2. If do open 'Home'
3. If do not open 'ProductKey' (In that form store result of validation in registry/web service/config file)
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 1-Dec-15 14:47pm    
Sure, a 5.
—SA
Kornfeld Eliyahu Peter 1-Dec-15 14:50pm    
Thank you!
In order to accomplish such a task you need to persist the info that your "ProductKey" form has been already shown. See, for instance "Walkthrough: Persisting an Object (C# and Visual Basic)"[^].
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 1-Dec-15 14:47pm    
Sure, a 5.
—SA
CPallini 1-Dec-15 16:30pm    
Thank you.

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