Click here to Skip to main content
16,006,749 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: GPRS MMS Pin
Christian Graus18-Oct-09 22:35
protectorChristian Graus18-Oct-09 22:35 
Question[Message Deleted] Pin
quadrilateral18-Oct-09 21:34
quadrilateral18-Oct-09 21:34 
AnswerRe: Speech in VB Pin
Christian Graus18-Oct-09 21:50
protectorChristian Graus18-Oct-09 21:50 
GeneralRe: Speech in VB Pin
quadrilateral19-Oct-09 17:21
quadrilateral19-Oct-09 17:21 
QuestionHow to retrieve parameters by using HTTP headers in vb.net Pin
arabicwind18-Oct-09 20:09
arabicwind18-Oct-09 20:09 
QuestionListview display problem Pin
Gagan.2018-Oct-09 18:11
Gagan.2018-Oct-09 18:11 
AnswerRe: Listview display problem Pin
Christian Graus18-Oct-09 21:55
protectorChristian Graus18-Oct-09 21:55 
QuestionSerial Code - continued Pin
offroaderdan18-Oct-09 3:11
offroaderdan18-Oct-09 3:11 
Hi,
I wanted to create an app to incorprate on my program where the user has to type in a serial number before the applicaion is then displayed. Then when the application is then re-run the serial number form is NOT shown due to the serial number having already been inputted.

I will be honest i am not the greatest programmer so bear with me.

Here is the code i have currently used howver this HALF works.
This will allow the user to enter the serial code and show form 2 however when the user re-runs the app then it doesn't run?!?! The form flashes up for .1 of a second and then disappears.

Public Class Form1
    Dim FILE_NAME As String = ("serial.txt")

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim objReader As New System.IO.StreamReader(FILE_NAME)

        Do Until objReader.EndOfStream
            If txtserial.Text = objReader.ReadLine Then
                Startnot.Checked = False

                Form2.Show()
                Me.Hide()
            Else
                Try
                    If txtserial.Text = objReader.ReadLine.Trim Then

                    End If

                Catch Ex As Exception


                End Try
                Label1.Text = "Invalid CDKey"
            End If

        Loop
        objReader.Close()


    End Sub

    Private Sub Form1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
        If Me.Visible = False Then
            Form2.Show()
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SetAttr(FILE_NAME, FileAttribute.Normal)
        Dim Dontshow As Boolean

        Dontshow = GetSetting(My.Application.Info.ProductName, "Options", "Dont Show Me", 1)

        If Dontshow = 0 Then
            Form2.Show()
            Call cookies()
            Exit Sub
        End If

        Startnot.Checked = True
    End Sub

    Private Sub Startnot_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Startnot.CheckedChanged
        SaveSetting(My.Application.Info.ProductName, "Options", "Dont Show Me", Startnot.CheckState)
    End Sub

    Private Sub cookies()

        Me.Close()
        My.Forms.Form2.Show()
    End Sub

End Class


I got some previous feedback from another programmer saying

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


howeve i am ereally struggaling to incorprate this code so if any body could help me fix this then that would be very nice.

Many thanks

Dan
AnswerRe: Serial Code - continued Pin
Christian Graus18-Oct-09 14:43
protectorChristian Graus18-Oct-09 14:43 
GeneralRe: Serial Code - continued Pin
Luc Pattyn18-Oct-09 14:51
sitebuilderLuc Pattyn18-Oct-09 14:51 
GeneralRe: Serial Code - continued Pin
Christian Graus18-Oct-09 14:56
protectorChristian Graus18-Oct-09 14:56 
GeneralRe: Serial Code - continued Pin
Enver Maroshi18-Oct-09 23:51
Enver Maroshi18-Oct-09 23:51 
GeneralRe: Serial Code - continued Pin
offroaderdan19-Oct-09 0:26
offroaderdan19-Oct-09 0:26 
Questionsend email from excel through outlook web access Pin
jetgrageda18-Oct-09 1:00
jetgrageda18-Oct-09 1:00 
AnswerRe: send email from excel through outlook web access Pin
Dave Kreskowiak18-Oct-09 2:24
mveDave Kreskowiak18-Oct-09 2:24 
QuestionCheckBox column in DataGridView Pin
ivo7518-Oct-09 0:57
ivo7518-Oct-09 0:57 
AnswerRe: CheckBox column in DataGridView Pin
dan!sh 18-Oct-09 1:00
professional dan!sh 18-Oct-09 1:00 
GeneralRe: CheckBox column in DataGridView Pin
ivo7518-Oct-09 1:53
ivo7518-Oct-09 1:53 
GeneralRe: CheckBox column in DataGridView Pin
dan!sh 18-Oct-09 11:29
professional dan!sh 18-Oct-09 11:29 
GeneralRe: CheckBox column in DataGridView Pin
Dambod18-Oct-09 19:53
Dambod18-Oct-09 19:53 
QuestionAdding events to line (shape) Pin
helelark12317-Oct-09 23:26
helelark12317-Oct-09 23:26 
AnswerRe: Adding events to line (shape) Pin
dan!sh 18-Oct-09 0:55
professional dan!sh 18-Oct-09 0:55 
GeneralRe: Adding events to line (shape) Pin
helelark12318-Oct-09 1:10
helelark12318-Oct-09 1:10 
GeneralRe: Adding events to line (shape) Pin
dan!sh 18-Oct-09 1:19
professional dan!sh 18-Oct-09 1:19 
QuestionLogin Authentication help would be appreciated Pin
spamnchips17-Oct-09 2:46
spamnchips17-Oct-09 2:46 

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.