J. Scott Elblein
Well-known member
In the app I am writing for work, I have a webrowser control, that has a login form.
What I 'd like to do is have the program store the login & password automatically for them after they type it in and click the Submit button, which I then add to a drop-down combobox, so they can easily just select them next time (they often have to have multiple logins), and login automatically for them just by switching the logins in the combobox.
I have written some basic code which works well enough with a little post-handling to clean it up, but it's also a bit squirrly. I put it in the WBR_PreviewKeyDown event, the problem is, that event gets called multiple times per key, and sometimes seems to just keep randomly getting called, especially when someone uses Shift+Some-Letter. I was wondering if anyone has some better code, or maybe just an idea no how to tweak this code so it's more stable/solid? (Just for testing you can use any website that requires a login and pass, yahoo email for example):
Right now during testing, I just use a messagebox to show me, but later would use that as the place to do what I want as far as adding to the combobox. I actually considered looking for some keylogger code and adjusting it to my needs for this app, but that seems a bit overboard and shady, and don't really want to mess with that stuff, lol.
Thanks again for all help guys.
What I 'd like to do is have the program store the login & password automatically for them after they type it in and click the Submit button, which I then add to a drop-down combobox, so they can easily just select them next time (they often have to have multiple logins), and login automatically for them just by switching the logins in the combobox.
I have written some basic code which works well enough with a little post-handling to clean it up, but it's also a bit squirrly. I put it in the WBR_PreviewKeyDown event, the problem is, that event gets called multiple times per key, and sometimes seems to just keep randomly getting called, especially when someone uses Shift+Some-Letter. I was wondering if anyone has some better code, or maybe just an idea no how to tweak this code so it's more stable/solid? (Just for testing you can use any website that requires a login and pass, yahoo email for example):
VB.NET:
In KeyPreviewDown event:
' Static var so we can try to only catch a keypress one time instead of multiples.
Static Dim boolOneTime As Boolean
If boolOneTime = True Then
strITLP += e.KeyCode.ToString
boolOneTime = False
Else
boolOneTime = True
End If
--
(Then I have this at the top of the form so I can use it in other Subs: Dim strITLP As String)
--
And in the DocumentCompleted event, after the next page loads after logging in, I have this:
MessageBox.Show(strITLP)
strITLP = String.Empty
Thanks again for all help guys.