Results 1 to 35 of 35

Thread: [RESOLVED] Submit HTML form in VB

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Resolved [RESOLVED] Submit HTML form in VB

    Hello All, I am new to VB. I just want a program compiled in Visual Basic 2008 or VB6 portable. which can just submit a form of only one field, i don't want to go to that url every time to do so.
    What I want here, just to open exe, fill that field and submit. can anyone describe in detailed step by step? or just write the complete code.
    the HTML code for that form is <form name='enterMsisdn' action='http://www.target.com/authenticate.jsp' method='post'>
    <textarea name='msisdn' rows='1' cols='10'></textarea>
    <input type='submit' name='submit' value='Add Comment'>
    </form>

  2. #2
    Fanatic Member newprogram's Avatar
    Join Date
    Apr 2006
    Location
    in your basement
    Posts
    769

    Re: Submit HTML form in VB

    did you search this form?there about 100 example
    Quote Originally Posted by wiqionline View Post
    Hello All, I am new to VB. I just want a program compiled in Visual Basic 2008 or VB6 portable. which can just submit a form of only one field, i don't want to go to that url every time to do so.
    What I want here, just to open exe, fill that field and submit. can anyone describe in detailed step by step? or just write the complete code.
    the HTML code for that form is <form name='enterMsisdn' action='http://www.target.com/authenticate.jsp' method='post'>
    <textarea name='msisdn' rows='1' cols='10'></textarea>
    <input type='submit' name='submit' value='Add Comment'>
    </form>
    Live life to the fullest!!

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    Can you please refer one example?

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    I don't understand where to put action URL in button.

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Submit HTML form in VB

    you have to submit the form to the website, how are you going to send the data, an inet control, webbrowser control or other method? there are several choices
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6
    Fanatic Member newprogram's Avatar
    Join Date
    Apr 2006
    Location
    in your basement
    Posts
    769

    Re: Submit HTML form in VB

    ok please be more detailed on what you want done where the form at on the target website you want to submit?
    Live life to the fullest!!

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    thanks for response and Yes the form is on the website. i just want to submit that form from vb application. please please please do write here the complete source that i can just copy and paste to my vb code.

  8. #8
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Submit HTML form in VB

    please please please do write here the complete source that i can just copy and paste to my vb code.
    no way, we are here to help, not do it for you

    you still did not say what method you want to use to 'post' the data
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    my dear I want a one field form to be submitted using a VB compiled application. text where field name is 'msisdn' form name is 'entermsisdn' and button is 'submit'. target url where form should be posted is 'http://example/authenticate.jsp'
    Here is the html page coding:
    <form name='enterMsisdn' action='target url/authenticate.jsp' method='post'>
    <textarea name='msisdn' rows='1' cols='10'></textarea>
    <input type='submit' name='submit' value='Add Comment'>
    </form>

    guide me the complete source code for VB. Thanks in advance.

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    that would be called help if u guide me to do.

  11. #11
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Submit HTML form in VB

    that would be called help if u guide me to do.
    Yes.. We will guide you...

    Check this thread... : http://www.vbforums.com/showthread.php?t=384076
    Particularly, this post...: Auto Submit

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    Thanks a lot dude u worked for me but problem is still here. in debug, name "WebBrowser1" is not declared. What to do?

  13. #13
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Submit HTML form in VB

    You have to add a WebBrowser control to your form.

    Press ctrl + T (or, Project menu -> Components). From the list, select and put check mark on Microsoft Internet Controls. Then press OK. Now, your toolbox will contain a tool with an Earth's icon. That is webbrowser control. Select it and add it to your form....

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  14. #14

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    Thanks dear very very thanks again, that really helped me a lot. I have succeed navigating the target page. i wanted not to appear target page so changed the visible to false. worked. but now the main thing. i don't have idea to submit form by clicking vb's submit button. how to attach textbox to submit button and submit button effect to target url.
    Further Thanks in advance.....

  15. #15
    New Member
    Join Date
    Feb 2010
    Posts
    1

    Re: Submit HTML form in VB

    I get the same problem i just used web browser1 a few mins ago and now its gone! Please help me!

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    follow the instruction as above. but i am still in trouble that how to attach the textbox to the submit button and then navigate to submit form.

  17. #17
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Submit HTML form in VB

    Quote Originally Posted by wiqionline View Post
    Hello All, I am new to VB. I just want a program compiled in Visual Basic 2008 or VB6 portable. which can just submit a form of only one field, i don't want to go to that url every time to do so.
    What I want here, just to open exe, fill that field and submit. can anyone describe in detailed step by step? or just write the complete code.
    the HTML code for that form is <form name='enterMsisdn' action='http://www.target.com/authenticate.jsp' method='post'>
    <textarea name='msisdn' rows='1' cols='10'></textarea>
    <input type='submit' name='submit' value='Add Comment'>
    </form>
    using the name of the fields, and the AutoSubmit code(link posted above), will work. But before that, don't put the visibility of that control to false. After you have succeeded in doing what you needed you can do whatever modification needed....

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    Dear it auto fills the webbrowser form. I want to fill manually in textbox created in vb. and that should be posted to the target url.... I think no one is understanding my problem.
    I should surrender...

  19. #19
    Addicted Member
    Join Date
    Aug 2009
    Posts
    227

    Re: Submit HTML form in VB

    That's never a good attitude to have :P

    What you need to do is add a TextBox control to your Form. Then, in the Auto Submit code (linked above), where it says "strwebsite = ", put "strwebsite = Text1.Text" instead of the URL that is already input in that code.

    Let me know if that solves your problem.

  20. #20
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Submit HTML form in VB

    Quote Originally Posted by wiqionline View Post
    Dear it auto fills the webbrowser form. I want to fill manually in textbox created in vb. and that should be posted to the target url.... I think no one is understanding my problem.
    I should surrender...
    Check this thread: http://www.vbforums.com/showthread.php?t=334645 ....

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    aaaghhhhhhhh.......

    addurl is not a member of system.windows.forms.HTMLdocument

  22. #22
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Submit HTML form in VB

    What version of VB are you using...??? Is that VB6 or VB.Net(includes VB2008,VB2005,etc...) ...?

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  23. #23

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    OK Well, all thing is done, page loaded in webbrowser1 within VB but when i click on submit button, nothing happens......

  24. #24

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    is this necessary to navigate to the page of loading of form? i don't need the form to be loaded. i just just just just just submit the textfield to the target url.

  25. #25
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Submit HTML form in VB

    Check whether it is working or not(before hiding)... After that, try hiding the control....

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  26. #26
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Submit HTML form in VB

    Quote Originally Posted by akhileshbc View Post
    What version of VB are you using...??? Is that VB6 or VB.Net(includes VB2008,VB2005,etc...) ...?
    What is the answer to this question?

  27. #27

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    VB6. that error occurred in visual basic 2008. now i am back on vb6.
    The person who understands HTML coding and VB6 coding, can only guide me to resolve my issue. it's just simple but i don't know how. one field named "msisdn" one button named "submit" and submitting that field through submit button to target url. Why aren't yo ppl getting my point????

  28. #28

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    Ok i have made this thing. made one textbox named "msisdn", one button named "Submit" and webbrowser1 added to form.
    That something look like this.


    Private Sub Submit_Click()

    Dim txt As String


    txt = "msisdn.text"


    WebBrowser1.Document.addurl.URL.Value = txt

    WebBrowser1.Document.addurl.Submit

    End Sub

    Private Sub Form_Load()

    WebBrowser1.Navigate "http://dms.telenor.com.pk/sca_tp/authenticate.jsp"
    End Sub

    Hitting F5, form loads web page in webbrowser1. clicking Submit button in form error occurred
    Run-Time '438' Object doesn't support this property of method.
    and debugging highlights the line
    WebBrowser1.Document.addurl.URL.Value = txt

    Now I think much detail.

  29. #29
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Submit HTML form in VB

    you need to look at the source page of the website to find the correct names for the text input of that page

    you can try this where wb is the name of your webbrowser control
    vb Code:
    1. wb.navigate2 "http://dms.telenor.com.pk/sca_tp/login.jsp?"
    2. Do Until wb.readystate = 4
    3. DoEvents
    4. Loop
    5. Set f = wb.document.forms(0)
    6. f.all("msisdn").Value = "1235"
    7. f.submit
    tested works, change the literal value (1235) for your textbox
    f.all("msisdn").Value = text1.text
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  30. #30

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: Submit HTML form in VB

    Quote Originally Posted by westconn1 View Post
    you need to look at the source page of the website to find the correct names for the text input of that page

    you can try this where wb is the name of your webbrowser control
    vb Code:
    1. wb.navigate2 "http://dms.telenor.com.pk/sca_tp/login.jsp?"
    2. Do Until wb.readystate = 4
    3. DoEvents
    4. Loop
    5. Set f = wb.document.forms(0)
    6. f.all("msisdn").Value = "1235"
    7. f.submit
    tested works, change the literal value (1235) for your textbox
    f.all("msisdn").Value = text1.text

    Thanks party you are the MAN I Love You
    now could you or anyone help me out for looping? i removed your do event loop because that is not working anymore.
    Thanks again
    Need Looping..... untill form closed. Also form should work when webbrowser1 visibility set to false. but at this time it's not working.
    Last edited by wiqionline; Feb 9th, 2010 at 05:09 PM.

  31. #31
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [RESOLVED] Submit HTML form in VB

    if you do not loop until the web browser is ready you will get an error, that loop is essential, though doevents is not and can be omitted, just may freeze computer while waiting for the page to load

    this should work fine when web browser not visible
    Need Looping..... untill form closed.
    i have no idea what you mean by this
    to close the form after submitting

    vb Code:
    1. f.submit
    2. unload me
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  32. #32

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: [RESOLVED] Submit HTML form in VB

    Well i have to put 2 buttons. one for start submitting simultaneously and second to stop submitting. how would 1st button be set to start submitting until 2nd button pressed. repeat or loop whatever need.

  33. #33
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: [RESOLVED] Submit HTML form in VB

    Do you mean, Start button will open the form for sending and close button will close the form....like that...???

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  34. #34

    Thread Starter
    Junior Member
    Join Date
    Feb 2010
    Posts
    25

    Re: [RESOLVED] Submit HTML form in VB

    no no no akhil. well i have done. using do while cancel procedure. Thanks a lot all...........
    now can I have exe that can not be recovered as vb script???? any decompiler can not read source code..... any idea?

  35. #35
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: [RESOLVED] Submit HTML form in VB

    File menu -> Make EXE will create the EXE....

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width