Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
SometimesInventorMakesMeAngry
486 Views, 6 Replies

Basic VB question

This is probably something very basic, but I would like to know the reason why the following does not work:

 

Sub Main()
    Dim oDoc as Inventor.Document = ThisApplication.ActiveDocument
    Dim sDispName as String = oDoc.DisplayName
    sDispName = "doc123"
End Sub

 

Whereas the following works fine:

 

Sub Main()
    Dim oDoc as Inventor.Document = ThisApplication.ActiveDocument
    oDoc.DisplayName = "doc123"
End Sub

 

 I'm guessing it has something to do with not referencing the object or something, but would like to be sure. If this is the case, when would I need to make sure I set a reference to an object with the various properties in the API? Is it only if the type of the property is not a built-in VB data type?