Results 1 to 21 of 21

Thread: [RESOLVED] How control web component in VB6

Hybrid View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    Re: How control web component in VB6

    Hi TheVader,
    Good day,
    Hope you fine.

    Once again here I beg your help regarding my project which is enriched with your strong support.

    My project in VB 6.0 for a money transfer company uisng different Online money services is almost finished the work. And in this time I rememebr you help, support and guidence in my project especially in DHTML Document Object Model.

    Regarding to the same problem let me put my new problem I face in my project.

    The work for www.ezremit.com.kw is almost completed and now I am writing code for another speed service ARY Speed Remittance.

    Since this site is developed in ASP .Net I cannot take control on the objects of this site.

    Whenever I follow the same procedure you tought me for ezremit.com.kw VB says error and says

    'Object variable or With Block variable not set' . I don't know what is the mistake. Here you can visit the site by this address

    http://demo.speedremit.ae/

    User name : uaedemo
    PassWrd : demo


    I used the following code to login automatically

    dim UserID as string
    dim PsWd as string

    UserID = "uaedemo"
    PsWd = "demo"

    Private Sub CmdLogIn_Click()
    browser.Document.getElementById("txtLoginName").Value = UserID
    browser.Document.getElementById("txtPassword").Value = PsWd
    End Sub


    This time the error number 91 arises with message 'Object variable or With Block variable not set'

    I think the problem may be for the site is developed by ASP .Net

    Now I expect your sincere help regarding this porblem.

    Expecting your best cooperation

    Nasreen

  2. #2
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: How control web component in VB6

    Hi Kati,

    I'm glad to tell you I've found the error in your code. Actually your code was correct, but you called it from the wrong document. Let me explain; the whole page consists of a frameset (you can see this by going to View > Source in Internet Explorer). This frameset exists in the source document (the one that is accessed by browser.Document).
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
    
       </script>
    <html>
     <head>
      <TITLE>Welcome to ARY Speed Remit :: We understand your needs</TITLE>
     </head>
     <frameset rows="0,*" border="0">
      <frame name="header" src="about:blank" scrolling="no" noresize>
      <frame name="main" src="Login.aspx">
      <noframes>
       <p id="p1">
        This HTML frameset displays multiple Web pages. To view this frameset, use a 
        Web browser that supports HTML 4.0 and later.
       </p>
      </noframes>
     </frameset>
    </html>
    From the source you can tell there are two frames, "header" and "main'. It seems the second frame is the one that holds the page we're looking for. So we have to access the document of that particular frame. It can be done like this:

    browser.Document.frames.Item(1).Document.getElementById("txtLoginName").Value = UserID
    browser.Document.frames.Item(1).Document.getElementById("txtPassword").Value = PsWd

    So the problem is not caused by the ASP used. In fact, server-side scripting with ASP or PHP can never cause these problems, because the code that is finally received by the browser is always plain HTML.

    Best regards,
    Michiel
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    105

    Re: How control web component in VB6

    Dear Sir,

    Thanks so much
    Thanks again for your genuine guidence. Now the code is working properly,

    Wishing all the bests and expecting the best support and cooperations

    Nasreen

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