Showing results for 
Search instead for 
Do you mean 
Reply

Passing Event and Element to a function

To all

 

I am trying to breakdown a large-ish code into 2 or 3 smaller functions. Is it possible to pass RSEVent and Element as "object" (don't know if it's the right vba term!)

somethin kije

 

function JustGetOnWithItunction(MyRSEvent As CAE.ResponseSimulation.RSEvent, myFEElm As NXOpen.CAE.FEElement)

 

Breakingdown the main sub means it's easier to understand/manage but it's means that I have to repeat some lines of codes. Maybe using Public Dim might be easier

 

Any hint would be aprreciated

 

thanks

 

Regards

 

JXB

 

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)
2 REPLIES

Re: Passing Event and Element to a function

[ Edited ]

Yes, you can pass objects into a subroutine or function as parameters.

 

If you find repeating lines of code (or repeating sections of code) in your Main routine, these are prime candidates to break out into separate subroutines or functions.

 

When the functionality of your program is broken down properly into functions and subroutines, you should end up with no repeated code.

Re: Passing Event and Element to a function

Thansk cowski1. Work well and simplfy the code a bit. Much appreciated

Production: NX9.0.3.4, NX10.0.2.6
Development: VB.NET (amateur level !)