Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Status
Not open for further replies.

Aleks_TS

Mechanical
Jul 5, 2020
22
0
0
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
 
Replies continue below

Recommended for you

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.
Back
Top