-
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
-
Try putting a DoeEvents instead of an MsgBox.
-
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
-
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?
-
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