SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Jan 2008
    Posts
    54
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Problem in calling the sub

    hi every one!
    if i run with out sub it works fine.
    But if i convert it to a cub it does not work can some tell me why is that?

    Sub Main()
    trythis = trytoGETTheurl
    MsgBox trythis
    End Sub


    Sub trytoGETTheurl()
    Dim lhwnd As Long
    Dim myurl As String
    HTMLBrowser("Index=1").Attach
    lhwnd = HTMLBrowser.hWnd
    myurl = HTMLBrowser("hWnd= " & lhwnd).URL
    'MsgBox myurl
    End Sub

  2. #2
    Member
    Join Date
    Jan 2008
    Posts
    54
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problem in calling the sub

    i know it is a data type problem but i dont know i have been struggling with this since last 3 hours.Help need .thanks

  3. #3
    Moderator tristaanogre's Avatar
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA
    Posts
    1,792
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problem in calling the sub

    Well, I'm not a well versed person in VBScript but a couple of questions...

    1) your second line of Sub Main... shouldn't the call to trytoGETTheurl have a pair of parenthesis after it?

    2) Your Sub trytoGetTheurl doesn't have a call to return anything. Shouldn't there be a "return myurl" in there somewhere?
    -Robert Martin
    Automated Testing Evangelists
    TestComplete "expert"
    Definition expert - noun - Unknown drip under pressure

  4. #4
    Member
    Join Date
    Jan 2008
    Posts
    54
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problem in calling the sub

    yes u are right.i thing this is how vbscript works.it automatically return the result.because when i capture is it after the function was called it gets the result.

  5. #5
    Junior Member
    Join Date
    Sep 2007
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problem in calling the sub

    Try changing the Sub to Function.

    Function trytoGETTheurl()
    Dim lhwnd As Long
    Dim myurl As String
    HTMLBrowser("Index=1").Attach
    lhwnd = HTMLBrowser.hWnd
    myurl = HTMLBrowser("hWnd= " & lhwnd).URL
    trytoGETTheurl = myurl
    'MsgBox trytoGETTheurl
    End Function


    Gene

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:06 AM.

Copyright BetaSoft Inc.