Solved

Easy VB6 to VB.NET conversion help please

Posted on 2004-10-29
231 Views
Last Modified: 2010-04-23
I'm trying to make a small app that has a browser window and a button on a form that will load a webform at www.ASpecificForm.com\form1.asp and fill in the textboxes on the form with data I already have.
The purpose is so that I don't have to enter in the same data twice.
ie: I enter in the customer information into my own database, then I have to navigate to the webform at www.this1website.com\form1.asp and re-type it again just to get the customer info into the web form so that I can submit it via the Submit button on the webform itself.

I want a way to auto load as much info as I can into the form to save some time. I'm using the same form over and over on a daily basis....
I have some code that I think might work but I don't have vb6..only vb.net.
Can someone help me translate it into VB.NET or give me a better Idea how to do it. I've already checked with the company and they dont' offer any type of web service to send data to.


 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       WebBrowser1.Navigate2("www.this1website.com\form1.asp ")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If WebBrowser1.Busy Then
            MsgBox("PAGE IS STILL LOADING...PLEASES WAIT")
            Exit Sub
        Else
            WebBrowser1.Document.all("app_first_name").value = "MY FIRST NAME"
            WebBrowser1.Document.all("app_last_name").value = "LAST NAME"
            'etc etc for other fields
            'app_first_name is the input name. ie: <input type=text  name="app_first_name">

            'submit the form by clicking the submit button on the webform itself
        End If
    End Sub
**************END CODE*******************
0
Question by:Matrix1000
    3 Comments
     
    LVL 69

    Accepted Solution

    by:
    It is much the same.

    Have you found the Web Browser control in VB.Net? See http://support.microsoft.com/default.aspx?scid=kb;en-us;821771

    I did much the same yesterday:

        Private mblnDownloadCompleted As Boolean

        Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
            mblnDownloadCompleted = False
            With AxWebBrowser1
                .Navigate2("www.this1website.com\form1.asp")
                Do While Not mblnDownloadCompleted
                    Application.DoEvents()
                Loop
                .Document.All("app_first_name").Value = "MY FIRST NAME"
                .Document.All("app_last_name").Value = "LAST NAME"
                .Document.Forms(0).Submit()

                mblnDownloadCompleted = False
                Do While Not mblnDownloadCompleted
                    Application.DoEvents()
                Loop
            End With
        End Sub

        Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles AxWebBrowser1.DocumentComplete
            mblnDownloadCompleted = True
        End Sub
    0
     
    LVL 1

    Author Comment

    by:Matrix1000
    THANKS!!!

    One question, how would I send that to a specific frame...the site I'm working with has an upper navigation frame that contains a bunch of tabs and a the lower frame contains the actual form....

    Thanks for any assistance.
    0
     
    LVL 69

    Expert Comment

    by:Éric Moreau
    I don't know about the frame!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now