Results 1 to 3 of 3

Thread: Registration - String to Double?

  1. #1
    Haxaro is offline VB.NET Forum Fanatic
    .NET Framework
    .NET 4.0
    Join Date
    Mar 2009
    Posts
    105
    Reputation
    56

    Question Registration - String to Double?

    I am making a registration feature for my program, and so far, this is my code

    Code:
            If UserID.Text * (KeyID.Text / 994) > "2067189894" And UserID.Text * (KeyID.Text / 994) < "2026581216" Then
                MsgBox("The User ID and Key are Correct! Click Register to complete registration for Student Pad")
            Else
                MsgBox("That User ID and Key Do Not Match. Make sure you copy and paste the Registration key from the email you were sent in to the correct fields.")
            End If
        End Sub
    
        Private Sub Register_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Register.Click
            If UserID.Text * (KeyID.Text / 994) > "2071148994" And UserID.Text * (KeyID.Text / 994) < "2072518216" Then
                MsgBox("The User ID and Key are Correct! Registration is now complete. You now have full access to EVERY feature! Thank-You for registering")
            Else
                MsgBox("That User ID and Key Do Not Match.")
                End
            End If
    There are still quite a few bugs in this script, including, when text is added to the field, it comes up with an error - naturally.

    Any ideas of how i can make this code cleaner, or better?

    And how can i make it so when the register code is correct, it saves either in an ini for in the registry???

    Thanks in advance

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    11,362
    Reputation
    1544
    Use Double.TryParse to convert the String to a Double and return False if it fails.

  3. #3
    InertiaM is offline VB.NET Forum Idol
    .NET Framework
    .NET 2.0
    Join Date
    Nov 2007
    Location
    Kent, UK
    Posts
    661
    Reputation
    226
    I also suggest you start using

    Code:
    Option Strict On

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking