Registration - Tutorial + Project Download
Posted: Mon Mar 01, 2010 3:45 am
*Make Sure that the user has no @gmail.com on it*
For Example :
i have a email at gmail - austinlivengood@gmail.com now what you do is you take the @gmail.com off
and the text that would be entered would just be austinlivengood
------------------------------------------------------------------------------------------------------------------------
ok well i am going to be showing you how to make a registration for your program, this has nothing to do with mysql and things. This is using a smtp. Its going to generate a key code for the use and most of the program will not be workable with out registration.
For Example :
![Image]()
Main Form
Now for this the form load is, this code will check and see if the program has been registered
This is one of the most important forms to the program, because this will save the settings of the key code.
![Image]()
ok so now one form load we its going to generate a random key code
Imports :
For Button 1 : i would like to give thanks to CodeNStuff for his wounderful coding on his email sender, i have used part of it to send out the email with the keycode. Thanks CodeNStuff cooll;
Button1 Click :
this will check and see if the key code is correct or not.
Settings :
Theses are the settings need in the project
![Image]()
Project Download :
For Example :
i have a email at gmail - austinlivengood@gmail.com now what you do is you take the @gmail.com off
and the text that would be entered would just be austinlivengood
------------------------------------------------------------------------------------------------------------------------
ok well i am going to be showing you how to make a registration for your program, this has nothing to do with mysql and things. This is using a smtp. Its going to generate a key code for the use and most of the program will not be workable with out registration.
For Example :

Main Form
Now for this the form load is, this code will check and see if the program has been registered
Code: Select all
Button 1 click: *Opens this registration form*
If My.Settings.key = "" Then
Button2.Enabled = False
Else
If My.Settings.inkey = My.Settings.key Then
Button2.Enabled = True
Else
Button2.Enabled = False
End If
End If
Code: Select all
Button 2 click: *After Registration*
Register.ShowDialog()
Code: Select all
Registration Form :NextForm.Show()
Me.Close()
This is one of the most important forms to the program, because this will save the settings of the key code.

ok so now one form load we its going to generate a random key code
Imports :
Code: Select all
Imports System.Net.Mail
Code: Select all
this code will generate a key code and if you have already registered then it will open a message box saying so. Private Sub Register_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Random()
If My.Settings.inkey = "" Then
Else
MsgBox("You have already registered!", MsgBoxStyle.Exclamation, Title:="Information")
Me.Close()
End If
If My.Settings.key = "" Then
Random()
My.Settings.key = Label1.Text
My.Settings.Save()
End If
End Sub
Public Sub Random()
If My.Settings.key = "" Then
Else
Dim Z As New Random
Label1.Text = Z.Next(100000, 999999999)
End If
End Sub
For Button 1 : i would like to give thanks to CodeNStuff for his wounderful coding on his email sender, i have used part of it to send out the email with the keycode. Thanks CodeNStuff cooll;
Button1 Click :
Code: Select all
Button 2 Click : Dim username As String
Dim password As String
username = Convert.ToString(My.Settings.uname)
password = Convert.ToString(My.Settings.pass)
Dim from As New MailAddress(My.Settings.from)
Dim [to] As New MailAddress(Me.TextBox3.Text)
Dim theMailMessage As New MailMessage(from, [to])
theMailMessage.Body = "Your Key is : " + My.Settings.key
theMailMessage.Subject = "Registration Key Code"
Dim theClient As New SmtpClient(My.Settings.server)
theClient.UseDefaultCredentials = False
Dim theCredential As New System.Net.NetworkCredential(username, password)
theClient.Credentials = theCredential
theClient.EnableSsl = True
Try
theClient.Send(theMailMessage)
Catch wex As Net.WebException
End Try
MsgBox("Keycode Sent!", MsgBoxStyle.Exclamation, Title:="Information")
this will check and see if the key code is correct or not.
Code: Select all
If TextBox2.Text = My.Settings.key Then
My.Settings.inkey = TextBox2.Text
My.Settings.Save()
MsgBox("Sucess!", MsgBoxStyle.Information, Title:="Registered")
Form1.Button2.Enabled = True
Me.Close()
Else
MsgBox("Wrong Key Code", MsgBoxStyle.Exclamation, Title:="Error")
End If
Settings :
Theses are the settings need in the project

Project Download :