Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Dear experts,
I want key generator for vb.net application.In that application user can generate a key and after that generated key user can use the application for a life time.So please help me.
Thanks in Advance.
Posted
Comments
Sergey Alexandrovich Kryukov 6-Dec-13 15:49pm    
Encryption key, or something else? A key for what? What would be the use of it? And so on...
—SA
ZurdoDev 6-Dec-13 16:16pm    
Sure. What's the question?
Ei Tar 7-Dec-13 2:25am    
Public Function Auto_GenerateNo() As String
Dim ds As New DataSet
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim st As String
Try
cn.ConnectionString = GetConstring()
cn.Open()
Dim s As String = "SELECT Max(Reg_No) AS max FROM tableName"
cmd.CommandText = s
cmd.Connection = cn
Dim da As MySqlDataAdapter = New MySqlDataAdapter(cmd)
da.Fill(ds)

If ds.Tables(0).Rows(0).Item("max").ToString = "" Then
st = "YG00000" & 1
Return st
Else
Dim s_cno As String = ds.Tables(0).Rows(0).Item("max").ToString.Substring(3)
Dim i As Integer = Convert.ToInt32(s_cno)
i = i + 1
st = "YG" + year + (i.ToString.PadLeft(6, "0"))
Return st
End If
cn.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, title)
End Try

End Function
'it can autogenerate the Reg_NO and i wish, this can hep 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