Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I want change this VB code to C# code, can anyone help me?
VB
Sub template_New_model()
 
' EXAMPLE: Creating a new model and save it
 
Dim ret As Long ' return value from OAPI calls
 
Dim filename As String
 
filename = "C:\test.edb"
 
Dim myEtabs As ETABS2013.cOAPI ' the OAPI class has methods related to high level program stuff, like .applicationStart()
 
Dim myModel As ETABS2013.cSapModel ' the SapModel class is where most things we are interested in reside
 
' Create the OAPI object
 
Set myEtabs = CreateObject("CSI.ETABS.API.ETABSObject") ' Create the OAPI object
 
' Start ETABS
 
myEtabs.ApplicationStart
Posted
Comments
Emre Ataseven 6-Jun-14 13:52pm    
Did you try anything really?
Member 10869153 6-Jun-14 14:10pm    
This a program for civil engineers that can using the Open Application Programming Interface for it, they insert tutorial in VB language I want use in C#, but I have problem in first of it !
this the link: http://docs.csiamerica.com/help-files/etabs-oapi/html/4dec0ec0-1983-4c07-90de-864a674842f0.htm

Um. The fragment you show is trivial - and just a fragment. So I'll show you how to do the bits you show, and let you get on with it.
VB:
VB
Dim ret As Long ' return value from OAPI calls

C#:
C#
long ret; // return value from OAPI calls
See what I mean? Trivial...

VB:
VB
Set myEtabs = CreateObject("CSI.ETABS.API.ETABSObject") ' Create the OAPI object
C#:
C#
myEtabs = CreateObject("CSI.ETABS.API.ETABSObject"); // Create the OAPI object

Trivial.


If you can't cope with changes like that, then you really, really, shouldn't be trying to use code from a different language, or you need to learn at least the basics of the language you are converting from.

Because although there are online converters - http://www.developerfusion.com/tools/convert/vb-to-csharp/[^] for example - they do need some checking when it gets complicated.
 
Share this answer
 
Comments
Member 10869153 6-Jun-14 20:54pm    
tnx for your help :)
OriginalGriff 7-Jun-14 4:02am    
You're welcome!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900