Results 1 to 5 of 5

Thread: strange: writing and right after that reading properties

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    Question

    i found a quite strange behaviour of visual basic, is that normal...?

    if i set an object property to a value and read it out right after that i get an automation error.

    Code:
    ' will cause an error
    object.property = "..."
    x = object.property
    but if i put a message box between the lines everything works fine...

    Code:
    ' works fine but bugs the user
    object.property = "..."
    msgbox ":-)"
    x = object.property
    why is that??? can i fix this problem without bugging the user with a message box? - ya know, a really often need to write and right after that read an objects property...


    matthias path

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Try putting a DoeEvents instead of an MsgBox.

  3. #3
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    I just tried:
    Code:
    Command1.Caption = "text"
    x = Command1.Caption
    and it worked fine!

    what properties are you setting that are causing this problem? (and with which object?)

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    the dhtmledit control

    i's using the dhtmledit control with the following command:

    Code:
    DHTMLEdit1.DocumentHTML = "..."
    x = DHTMLEdit1.DocumentHTML
    by the way: another interesting thing is this command is working a first time but from then on it does not.

    strange, huh?

  5. #5
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    I know whats happening now.. You are trying to read it's property before the DHTML page is ready. Try putting this in your code:
    Code:
    DHTMLEdit1.DocumentHTML = "..."
    Do While DHTMLEdit1.Busy = True
        DoEvents
    Loop
    x = DHTMLEdit1.DocumentHTML
    that should do the trick..

    hope that helps,

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

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