Re: Quick And Easy Question
Quote:
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
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)'.
Re: Quick And Easy Question
Quote:
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?
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
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.
Re: Quick And Easy Question
TooLongName,
That will not work, because I need the Button1_Click to have the coding in it.
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
Re: Quick And Easy Question
norman_bates,
What is that going to do? I still need it to move to the second code.
Re: Quick And Easy Question
Quote:
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.......
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)