Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello I am trying to make a button which can log me out of facebook here is my code

VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Document.GetElementById("logout_form").InvokeMember("click")
end sub


But it is not working. Help me please.
Posted

Hey Lssn; btw. your code :-
WebBrowser1.Document.GetElementById("logout_form").InvokeMember("click")

I guess it's a creative way to do this, but it's not the exact way; I fixed the problem : I think the ID "logout_form" is not a button to click, it's about submitting this ID, So > Instead of ("click") put ("submit") - So it'll be :
WebBrowser1.Document.GetElementById("logout_form").InvokeMember("submit")


It'll work ...... ;)
 
Share this answer
 
Try this
First Login to your FB account(using chrome, IE etc.)
Then Logout as you do,
FAST! The page will redirect you to the logout page when it's redirecting copy
the URL.
Now on the logout button's click event add this :
<pre lang="c#">Webbrowser1.Navigate("The URL you copied")

~Sids123
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900