Using OpenSTAAD in a simple VB.NET project

From the outset let me be clear, I am not a programmer.  I am sure many of you will be able to look at the code I share and suggest better ways of achieving the same effect as demonstrated in this project.  Please feel free to add your comments and experience to help others produce their own solutions.

However, saying that I hope you will be able to see the important points that I am trying to share and that are needed to produce your own VB.NET project.

Over the years, I have used OpenSTAAD in VBA in macros in STAAD.Pro and in Excel.  However there are some noticable differnces that need to be observed to successfully use OpenSTAAD in a VB.NET project.

I have created a simple dialog that displays the number and list of beams and load cases in the current STAAD.Pro model.

The project is attached with some comments to indicate the important things that need to be taken into consideration compared to a similar VBA or VB6 project, namely

1) When using Option Strict, (eqiuivalent to OPTION EXPLICIT in VBA/VB6), then late binding is not supported and thus it is not possible to access object members such as would be done with objSTAAD.Geometry.***.  Therefore we need to create new variables for these members.

2) Function calls need to be cast to the expected return type, e.g. myBeamCount = CInt(mySTAADGeometry.GetMemberCount)

3) The most important point is that the size of INTEGERS and LONGS have changed and thus where in VBA we would define a varriable as a LONG, in VB.NET, this should now be defined as an INTEGER.

4) Functions that expect arrays, need to have these first cast as OBJECTS, the object passed, and the results cast back to the original array type.

Feel free to add other sample projects or tips to help others.

Regards

Carlos

Test OpenSTAAD.zip
Anonymous