Product Key Manager Suggestion
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
3 posts
Page 1 of 1
This is an expansion for an already existing post. You may find the original post here viewtopic.php?f=38&t=129, and you'll need to follow it before my information is of any use.
****ALL CODING DONE BY ME IS IN VB 2010!****
Here are a couple of things I added to the manager to make it even more effective.
I actually added a custom status button, a refresh button, and a 'page reader' box.
Add two buttons to the form and name the first 'Update' this will be for your custom status, and name the other 'Refresh', this will be used to double check the status of the serial.
For the update button have this code:
For the 'Refresh' button, add this code:
Finally, for the page reader textbox...
Add one Richtextbox to your form and leave it empty, if you wish, you could set it to readonly since there is no use editing it. The refresh button will get the page info and put it into the textbox. If you wan this to happen on load add this code to the form load events:
****ALL CODING DONE BY ME IS IN VB 2010!****
Here are a couple of things I added to the manager to make it even more effective.
I actually added a custom status button, a refresh button, and a 'page reader' box.
Add two buttons to the form and name the first 'Update' this will be for your custom status, and name the other 'Refresh', this will be used to double check the status of the serial.
For the update button have this code:
Code: Select all
Next, add a textbox to your form. If it isn't already, name it 'Textbox11', do not add any coding to it.Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\" + ComboBox2.Text + ".act", TextBox11.Text, True)
My.Computer.Network.UploadFile(Application.StartupPath + "\" + ComboBox2.Text + ".act", "ftp://YOURSITE.com/" + ComboBox2.Text + ".act", "USERNAME", "PASSWORD", True, 10, FileIO.UICancelOption.DoNothing)
If My.Computer.FileSystem.FileExists(Application.StartupPath + "\" + ComboBox2.Text + ".act") Then
My.Computer.FileSystem.DeleteFile(Application.StartupPath + "\" + ComboBox2.Text + ".act", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
My.Settings.update = TextBox11.Text
My.Settings.Save()
My.Settings.Reload()
End If
End Sub
For the 'Refresh' button, add this code:
Code: Select all
For this code to work properly, you will have to add a setting to your project called 'update' the code is not very well thought out, and probably will not work for all situations, but...Dim currentdatetime As Date = Now
Try
TextBox11.Clear()
If My.Computer.FileSystem.FileExists(Application.StartupPath & "\" + ComboBox2.Text + ".usr") Then
Using sr As New IO.StreamReader(Application.StartupPath & "\" + ComboBox2.Text + ".usr")
TextBox5.Text = sr.ReadToEnd
TextBox4.Text = TextBox5.Text.Split("|"c)(0)
TextBox6.Text = TextBox5.Text.Split("|"c)(1)
TextBox7.Text = TextBox5.Text.Split("|"c)(2)
TextBox8.Text = TextBox5.Text.Split("|"c)(3)
TextBox9.Text = TextBox5.Text.Split("|"c)(4)
TextBox10.Text = TextBox5.Text.Split("|"c)(5)
End Using
End If
Dim url As String = "http://YOURSITE.com/" + ComboBox2.Text + ".act"
Dim pageRequest As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
Dim pageResponse As WebResponse = pageRequest.GetResponse()
Dim page As String = ""
Using r As New StreamReader(pageResponse.GetResponseStream())
page = r.ReadToEnd()
End Using
RichTextBox1.Text = page
If page = "****KEY-USED********KEY-USED****" Then
Label1.ForeColor = Color.Green
Label1.Text = "Activated"
ElseIf page = "***KEY-DESTROYED***" Then
Label1.ForeColor = Color.OrangeRed
Label1.Text = "Destroyed"
ElseIf page = "****DE-ACTIVATED****" Then
Label1.ForeColor = Color.OrangeRed
Label1.Text = "De-Activated"
ElseIf page = My.Settings.update Then
Label1.ForeColor = Color.Blue
Label1.Text = "Custom Status Set"
Else
Label1.ForeColor = Color.Red
Label1.Text = "Custom Set, or Not Yet Activated."
If (currentdatetime > TextBox4.Text) Then
Button3.Enabled = True
End If
End If
Button4.Enabled = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Finally, for the page reader textbox...
Add one Richtextbox to your form and leave it empty, if you wish, you could set it to readonly since there is no use editing it. The refresh button will get the page info and put it into the textbox. If you wan this to happen on load add this code to the form load events:
Code: Select all
If there are errors in the code I posted, just reply and I'll try to fix 'em. Thanks for reading this! cooll;Dim url As String = "http://YOURSITE.com/" + ComboBox2.Text + ".act"
Dim pageRequest As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
Dim pageResponse As WebResponse = pageRequest.GetResponse()
Dim page As String = ""
Using r As New StreamReader(pageResponse.GetResponseStream())
page = r.ReadToEnd()
End Using
RichTextBox1.Text = page
A mod for one of my tutorials 
Great to see you taking existing tutorials and adding your own stuff to improve it. Excellent 2cool4cereal2 keep it up cooll;

Great to see you taking existing tutorials and adding your own stuff to improve it. Excellent 2cool4cereal2 keep it up cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
CodenStuff wrote:A mod for one of my tutorialsHa, thank you! I was trying to help out and I thought that this was a kind of useful and easy thing to do. I personally do really use it in my key manager. Thanks for the comment. cooll;
Great to see you taking existing tutorials and adding your own stuff to improve it. Excellent 2cool4cereal2 keep it up cooll;
I'll try to keep suggestions coming. ;)
Sincerely,
-2cool4cereal2
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023