Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Studio-'Let' and 'Set' assignment statements are no longer supported

Status
Not open for further replies.

Aleks_TS

Mechanical
Joined
Jul 5, 2020
Messages
22
Location
IT
Hi all
I have an error in Visual Studio that "Set" and "Let" commands are no longer supported. Does anyone know which command I should use?
Here is one small example of the code in VB and what would be the code in Visual Studio?
Sub CATMain()

Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument

Dim part1 As Part
Set part1 = partDocument1.Part

Dim hybridBodies1 As HybridBodies
Set hybridBodies1 = part1.HybridBodies

Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.Add()

part1.UpdateObject hybridBody1

End Sub

Thanks
 
JohnFx said:
Yes. In the old days you had to distinguish between assignment of objects and scalar types. Now everything is pretty much an object so they dumped the set keyword completely. I'm actually surprised they didn't leave it and have the compiler ignore it so the old code would compile without the change.


From other comments on that page it appears that Set is still used, just for some special cases.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top