Click here to Skip to main content
11,431,373 members (66,943 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VisualStudio2010
Hello everyone,I'm new at visual basic and I try auto login for website

Well,I'm stucked somewhere

I can insert id and pw but cant press login button because there's no div name?

Here's the code

<form name="giris" method="POST" action="/auth/signin">
            <input class="data-input" placeholder="Kullanıcı Adı" name="kullanici_adi">
            <input class="data-input" placeholder="Şifreniz" type="password" name="kullanici_sifre">
            <input type="submit" value="Giriş Yap" class="buton"><br>
                        </form>
My vb code is

WebBrowser1.Document.GetElementById("kullanici_adi").SetAttribute("nick", TextBox1.Text)
 WebBrowser1.Document.GetElementById("kullanici_sifre").SetAttribute("sifre", TextBox2.Text)
 WebBrowser1.Document.GetElementById("submit").InvokeMember("buton")
Posted 12-Nov-12 12:19pm
LegendM289
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

You try to set attributes with names like nick and sifre. This variable names doesn't exist. Try to set the value attribute. Also, to simulate a click, don't use this code:
 WebBrowser1.Document.GetElementById("submit").InvokeMember("buton")
But use this code:
 WebBrowser1.Document.GetElementById("submit").InvokeMember("click")
Hope this helps.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Don't do the wrong thing and then apologise. If you wanted to apologise, you wouldn't have done it. Your code won't work. You clearly are a beginner, and that is fine, but you're very confused right now. Buy a book and work through it. The web form won't work as 'button' is misspelled. You can use Document.Forms(0).Submit, if the browser object supports it, but learning to use VB to call javascript methods is not a sane way to learn VB, it's really kind of pointless. Write VB programs, not just code against the browser control, which is not really that useful, and is only going to teach you to call existant APIs, not write real code.
  Permalink  

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



Advertise | Privacy | Mobile
Web02 | 2.8.150428.2 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100