|
-
Jul 31st, 2010, 03:54 AM
#1
Thread Starter
Junior Member
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:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Enabled = True Then
WebBrowser1.Navigate("http://license.froltentertainment.com/login.html")
WebBrowser1.Document.GetElementById("username").SetAttribute("value", (TextBox1.Text))
WebBrowser1.Document.GetElementById("password").SetAttribute("value", (TextBox2.Text))
Sleep(5000)
Else
MsgBox("There was an error connecting to the Frolt Entertainment License System", MsgBoxStyle.Critical)
End If
End Sub
2 Code:
Private Sub ContinueLogin(ByVal sender As System.Object, ByVal e As System.EventArgs)
Sleep(1000)
If WebBrowser1.Url.Equals("http://license.froltentertainment.com/client/" & TextBox1.Text & ".php") Then
WebBrowser1.Document.GetElementById("paypal").InnerText.Contains("Valid")
Form2.Show()
Else
WebBrowser1.Document.GetElementById("paypal").InnerText.Contains("Invalid")
MsgBox("Your current subscription is invalid.", MsgBoxStyle.Critical)
End If
MsgBox("There was a problem with verifying your access to this program.", MsgBoxStyle.Critical)
End Sub
Last edited by griffithdesign; Jul 31st, 2010 at 04:40 AM.
-
Jul 31st, 2010, 04:02 AM
#2
Hyperactive Member
Re: Quick And Easy Question
 Originally Posted by griffithdesign
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:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show
End Sub
1 Code:
Private Sub ContinueLogin(ByVal sender As System.Object, ByVal e As System.EventArgs)
Label2.show()
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
-
Jul 31st, 2010, 04:04 AM
#3
Thread Starter
Junior Member
Re: Quick And Easy Question
norman_bates,
I have attempted that one earlier as well.
vb Code:
Error 1 Argument not specified for parameter 'e' of 'Private Sub ContinueLogin(sender As Object, e As System.EventArgs)'. Error 2 Argument not specified for parameter 'sender' of 'Private Sub ContinueLogin(sender As Object, e As System.EventArgs)'.
-
Jul 31st, 2010, 04:27 AM
#4
Hyperactive Member
Re: Quick And Easy Question
 Originally Posted by griffithdesign
norman_bates,
I have attempted that one earlier as well.
vb Code:
Error 1 Argument not specified for parameter 'e' of 'Private Sub ContinueLogin(sender As Object, e As System.EventArgs)'.
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?
-
Jul 31st, 2010, 04:29 AM
#5
Thread Starter
Junior Member
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:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Enabled = True Then
WebBrowser1.Navigate("http://license.froltentertainment.com/login.html")
WebBrowser1.Document.GetElementById("username").SetAttribute("value", (TextBox1.Text))
WebBrowser1.Document.GetElementById("password").SetAttribute("value", (TextBox2.Text))
Sleep(5000)
Else
MsgBox("There was an error connecting to the Frolt Entertainment License System", MsgBoxStyle.Critical)
End If
End Sub
-
Jul 31st, 2010, 04:36 AM
#6
Lively Member
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
-
Jul 31st, 2010, 04:37 AM
#7
Thread Starter
Junior Member
Re: Quick And Easy Question
TooLongName,
That will not work, because I need the Button1_Click to have the coding in it.
-
Jul 31st, 2010, 04:39 AM
#8
Hyperactive Member
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
-
Jul 31st, 2010, 04:41 AM
#9
Thread Starter
Junior Member
Re: Quick And Easy Question
norman_bates,
What is that going to do? I still need it to move to the second code.
-
Jul 31st, 2010, 04:45 AM
#10
Hyperactive Member
Re: Quick And Easy Question
 Originally Posted by griffithdesign
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.......
-
Jul 31st, 2010, 04:55 AM
#11
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|