vb6 - How to Pass a Late Bound Parameter -


In VB6, I am trying to pass a late bound object into another form.

frmMain Vb

  dim x set x = CreateObject ("MyOwn.Object") frmDialog set as a dim f fv = new frmDialog f.SetMyOwnObject x  

as a parameter in the

frmDialog parameter is a string in which type name is the late-bound object, "MyOwn.Object" ByVal and ByRef do not make any difference, no clue? There is a problem in remembering.

I used the warp (y). The result is 8, for vbString. This object must be 9 - ssorrrell 1 hour ago

Use the print y in the immediate window to find the contents of y - ssorrrell 55 minutes ago

This is to confirm my doubts It looks like MyOwn.Object should contain a default property or method that gives the string.

Therefore, when you try to debug . Print , this will return the value of the default property / method when you hover the variable in the IDE, then VB6 will display the value of the default property / method. When you call VarType call y , this will return the default property or variable type of method.

The reason for this is that when you have the variable type variant that stores a object , and defines the default method or property of the object's class In most situations,

you can see that MyOwn.Object class object browser is used to evaluate the return value of the variable default method or property. Opening the MyOwn.Object is the default member or not. Given your list of class and properties and methods. If you see any method or property with an icon with a small blue circle in the corner, then it indicates that the law or property is the default member of the class. If you find anyone, I can bet that it has been announced to return a string.

Note that if you have your variant S to Object S, you still will face this behavior in many places, for example, even if y has been declared as as an object, is doing a debug. Print Y will still print the value of the default property or method, and VarType (y) will still return 8 (the string).

When VB6 will use the default member and it will not be confused, for example, if you declare y as the object , Then TypeName (y) will return MyOwn.Class , but VarType (y) will still return 8 (string) however, If you declare y as the variant , then TypeName (y) returns string .

If you are using late binding, it is difficult to avoid this side effect, because you only assign your object variable to object or variables < / Code> will be able to declare.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -