Click here to Skip to main content
15,911,030 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Serial code login Pin
EliottA16-Oct-09 5:44
EliottA16-Oct-09 5:44 
GeneralRe: Serial code login Pin
EliottA16-Oct-09 5:34
EliottA16-Oct-09 5:34 
GeneralRe: Serial code login Pin
offroaderdan16-Oct-09 5:40
offroaderdan16-Oct-09 5:40 
GeneralRe: Serial code login Pin
EliottA16-Oct-09 5:42
EliottA16-Oct-09 5:42 
GeneralRe: Serial code login Pin
offroaderdan16-Oct-09 5:46
offroaderdan16-Oct-09 5:46 
GeneralRe: Serial code login Pin
Dave Kreskowiak16-Oct-09 5:53
mveDave Kreskowiak16-Oct-09 5:53 
GeneralRe: Serial code login Pin
offroaderdan16-Oct-09 6:01
offroaderdan16-Oct-09 6:01 
GeneralRe: Serial code login Pin
Dave Kreskowiak16-Oct-09 6:49
mveDave Kreskowiak16-Oct-09 6:49 
I'd start by scrapping what you have and replacing it with a seperate class. You main form should call this class, call it "Licensing", to ask if it is OK to run the app. The Licensing class has to do a few things to answer this question.

First, it has to check to see if the app has already been through the CDKey entry process and that a valid Key was entered. This could be a value written to the registry or to your AppSettings file.

If the value doesn't exist or it indicates that the license is not valid, this class would put up a new form, or even just an InputBox, asking for the CD key. Once the key is entered, it is compared against the first line of the serial.txt file. If they match, then you create/update the value tracking this in the Registry or your AppSettings file. If not, then Licensing doesn't change anything and returns False to say that it is not OK to run the app.

If the value is OK, then the method in your Licensing class would just return True to say that it is OK to run the app. There's no need to put up the CD Key entry form again.

You can get the first line of the file using:
Dim keyInFile As String
...
Using sr As New StreamReader(Path.Combine(Application.StartupPath), "serial.txt"))
    keyInFile = fs.ReadLine()
End Using



A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008
But no longer in 2009...




GeneralRe: Serial code login Pin
Christian Graus16-Oct-09 10:36
protectorChristian Graus16-Oct-09 10:36 
GeneralRe: Serial code login Pin
Dave Kreskowiak16-Oct-09 14:38
mveDave Kreskowiak16-Oct-09 14:38 
AnswerRe: Serial code login Pin
Kschuler16-Oct-09 6:10
Kschuler16-Oct-09 6:10 
GeneralRe: Serial code login Pin
offroaderdan16-Oct-09 6:14
offroaderdan16-Oct-09 6:14 
Questioni want to print two crystal report pages on a single paper using code Pin
Dambod16-Oct-09 3:34
Dambod16-Oct-09 3:34 
AnswerRe: i want to print two crystal report pages on a single paper using code Pin
David Mujica16-Oct-09 4:48
David Mujica16-Oct-09 4:48 
QuestionRe: i want to print two crystal report pages on a single paper using code Pin
Kschuler16-Oct-09 6:12
Kschuler16-Oct-09 6:12 
AnswerRe: i want to print two crystal report pages on a single paper using code Pin
Dambod17-Oct-09 1:14
Dambod17-Oct-09 1:14 
AnswerRe: i want to print two crystal report pages on a single paper using code Pin
Samir Ibrahim17-Oct-09 4:14
Samir Ibrahim17-Oct-09 4:14 
GeneralRe: i want to print two crystal report pages on a single paper using code Pin
Dambod17-Oct-09 8:13
Dambod17-Oct-09 8:13 
GeneralRe: i want to print two crystal report pages on a single paper using code Pin
Dave Kreskowiak17-Oct-09 15:22
mveDave Kreskowiak17-Oct-09 15:22 
GeneralRe:Solved Pin
Dambod18-Oct-09 19:45
Dambod18-Oct-09 19:45 
QuestionMonth Calendar usage Pin
rabih.tawil16-Oct-09 0:51
rabih.tawil16-Oct-09 0:51 
AnswerRe: Month Calendar usage PinPopular
dan!sh 16-Oct-09 2:40
professional dan!sh 16-Oct-09 2:40 
GeneralRe: Month Calendar usage Pin
rabih.tawil16-Oct-09 2:47
rabih.tawil16-Oct-09 2:47 
GeneralRe: Month Calendar usage Pin
Henry Minute16-Oct-09 3:14
Henry Minute16-Oct-09 3:14 
GeneralRe: Month Calendar usage [modified] Pin
rabih.tawil16-Oct-09 3:33
rabih.tawil16-Oct-09 3:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.