Results 1 to 11 of 11

Thread: Quick And Easy Question

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    18

    Question Quick And Easy Question

    I am making an advanced login form but I do not know how to transfer from sub to sub, for example using the fake templates below. How would I make my program go to "ContinueLogin"? As I have tried to explain below.


    1 Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         If Button1.Enabled = True Then
    3.             WebBrowser1.Navigate("http://license.froltentertainment.com/login.html")
    4.             WebBrowser1.Document.GetElementById("username").SetAttribute("value", (TextBox1.Text))
    5.             WebBrowser1.Document.GetElementById("password").SetAttribute("value", (TextBox2.Text))
    6.             Sleep(5000)
    7.         Else
    8.             MsgBox("There was an error connecting to the Frolt Entertainment License System", MsgBoxStyle.Critical)
    9.         End If
    10.     End Sub

    2 Code:
    1. Private Sub ContinueLogin(ByVal sender As System.Object, ByVal e As System.EventArgs)
    2.         Sleep(1000)
    3.         If WebBrowser1.Url.Equals("http://license.froltentertainment.com/client/" & TextBox1.Text & ".php") Then
    4.             WebBrowser1.Document.GetElementById("paypal").InnerText.Contains("Valid")
    5.             Form2.Show()
    6.         Else
    7.             WebBrowser1.Document.GetElementById("paypal").InnerText.Contains("Invalid")
    8.             MsgBox("Your current subscription is invalid.", MsgBoxStyle.Critical)
    9.         End If
    10.         MsgBox("There was a problem with verifying your access to this program.", MsgBoxStyle.Critical)
    11.     End Sub
    Last edited by griffithdesign; Jul 31st, 2010 at 04:40 AM.

  2. #2
    Hyperactive Member
    Join Date
    May 2009
    Posts
    274

    Re: Quick And Easy Question

    Quote Originally Posted by griffithdesign View Post
    I am making an advanced login form but I do not know how to transfer from sub to sub, for example using the fake templates below. How would I make my program go to "ContinueLogin"? As I have tried to explain below.


    1 Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2. Form2.Show
    3. End Sub

    1 Code:
    1. Private Sub ContinueLogin(ByVal sender As System.Object, ByVal e As System.EventArgs)
    2. Label2.show()
    3. End Sub
    Try:

    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Form2.Show
    Call ContinueLogin 
    End Sub
    - see the addition I made? it's in BOLD

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    18

    Re: Quick And Easy Question

    norman_bates,
    I have attempted that one earlier as well.

    vb Code:
    1. Error   1   Argument not specified for parameter 'e' of 'Private Sub ContinueLogin(sender As Object, e As System.EventArgs)'.
    2. Error   2   Argument not specified for parameter 'sender' of 'Private Sub ContinueLogin(sender As Object, e As System.EventArgs)'.

  4. #4
    Hyperactive Member
    Join Date
    May 2009
    Posts
    274

    Re: Quick And Easy Question

    Quote Originally Posted by griffithdesign View Post
    norman_bates,
    I have attempted that one earlier as well.

    vb Code:
    1. Error   1   Argument not specified for parameter 'e' of 'Private Sub ContinueLogin(sender As Object, e As System.EventArgs)'.
    2. Error   2   Argument not specified for parameter 'sender' of 'Private Sub ContinueLogin(sender As Object, e As System.EventArgs)'.
    It should work mate. I've even just written a little prog to test it and it's fine. The code I used (that works) is:
    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim iCheck As String
    
    
            iCheck = LCase(TextBox1.Text)
    
            Select Case iCheck
                Case "password"
                    Call PassAccess()
                Case Is <> "password"
                    Call PassDenied()
            End Select
        End Sub
    
        Private Sub PassAccess()
            MsgBox("Access granted!", MsgBoxStyle.Information, "Granted")
            End
        End Sub
    
        Private Sub PassDenied()
            MsgBox("Invalid password!", MsgBoxStyle.Critical, "Denied")
        End Sub
    I don't mean to sound patronising but have you checked your spellings when writing the call or in the sub name?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    18

    Re: Quick And Easy Question

    Yes, the thing is you have Dimmed your string, I have not, my string starts with an If statement let me see if I can modify this.

    Actually here is my button1's code:
    1 Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         If Button1.Enabled = True Then
    3.             WebBrowser1.Navigate("http://license.froltentertainment.com/login.html")
    4.             WebBrowser1.Document.GetElementById("username").SetAttribute("value", (TextBox1.Text))
    5.             WebBrowser1.Document.GetElementById("password").SetAttribute("value", (TextBox2.Text))
    6.             Sleep(5000)
    7.         Else
    8.             MsgBox("There was an error connecting to the Frolt Entertainment License System", MsgBoxStyle.Critical)
    9.         End If
    10.     End Sub

  6. #6
    Lively Member
    Join Date
    Jul 2009
    Posts
    124

    Re: Quick And Easy Question

    Code:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Form2.Show()
            Call ContinueLogin()
            'or ContingueLogin() without the Call
        End Sub
    
        Public Sub ContinueLogin()
            Form2.Label2.Show()
        End Sub
    It didn't recognize the parameters because you didn't need them.
    Last edited by TooLongName; Jul 31st, 2010 at 04:40 AM. Reason: Didn't see that you posted some more. I type slow...
    RATE MY POST

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    18

    Re: Quick And Easy Question

    TooLongName,
    That will not work, because I need the Button1_Click to have the coding in it.

  8. #8
    Hyperactive Member
    Join Date
    May 2009
    Posts
    274

    Re: Quick And Easy Question

    Try using

    Code:
     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
    Dim iUsername As String = textbox1.text, iPassword As String = Textbox2.text
            If Button1.Enabled = True Then
                WebBrowser1.Navigate("http://license.froltentertainment.com/login.html")
                WebBrowser1.Document.GetElementById("username").SetAttribute("value", (iUsername))
                WebBrowser1.Document.GetElementById("password").SetAttribute("value", (iPassword))
                Sleep(5000)
            Else
                MsgBox("There was an error connecting to the Frolt Entertainment License System", MsgBoxStyle.Critical)
            End If
        End Sub
    Last edited by norman_bates; Jul 31st, 2010 at 04:44 AM. Reason: Forgot something

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    18

    Re: Quick And Easy Question

    norman_bates,
    What is that going to do? I still need it to move to the second code.

  10. #10
    Hyperactive Member
    Join Date
    May 2009
    Posts
    274

    Re: Quick And Easy Question

    Quote Originally Posted by griffithdesign View Post
    norman_bates,
    What is that going to do? I still need it to move to the second code.
    To be honest it won't really change much, except you now have the password and username loaded into variables to work with. Let me try something and get back to you on it.......

  11. #11
    Hyperactive Member
    Join Date
    May 2009
    Posts
    274

    Re: Quick And Easy Question

    OK I tried something but I couldn't get your code to work for button1 (prob cuz I aint got the rest of it)

    anyways try creating a new form with a textbox and a button leaving the original names and copy paste my original code in and try it to see if it works on your VB.

    Code:
    Select Case Does it work?
             Case "Yes"
               MsgBox.Show(":)", MsgBoxStyle.Exclamation, ":)")
             Case "No"
                MsgBox.Show("Dunno what to say", MsgBoxStyle.Critical, ":(")
    End Select
    (Lol, couldn't resist that bit of code)

Posting Permissions

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



Click Here to Expand Forum to Full Width