Solved

How to convert the code form vba macro to c#.net

Posted on 2014-09-12
4
185 Views
Last Modified: 2014-09-18
Hi,

could you please help me out how to convert the function from vba macro to c# code .i am not able to convert to c# code.Please help me out.
i mention in the below.

Public Sub Clear_ER_And_Impact_Info(Optional Number_of_Equations As Integer = 0)
  ReDim Face_ImpSpeed(1 To Number_BdyFace)
  ReDim BdyFace_Angle(1 To Number_BdyFace)
  ReDim Face_MassRate(1 To Number_BdyFace)
  If Number_of_Equa = 0 Then Number_of_Equa = UBound(Face_Erosion, 1)
  ReDim Face_Erosion(1 To Number_of_Equa, 1 To Number_BdyFace)
End Sub

Thank you in advance.
0
Comment
Question by:mannevenu26
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 40323315
Instead of using arrays, I would use generics (List<int>), and then you don't need to try to find an equivalent for ReDim in C#.  You can add and remove items, without needing to be concerned with size.
0
 

Author Comment

by:mannevenu26
ID: 40327972
Hi Bob Learned (TheLearnedOne),

Thank you i support your answer.
could you plz give how to change on below vba macro code.Please help me out regarding on this...

Public Sub Clear_ER_And_Impact_Info(Optional Number_of_Equations As Integer = 0)
  ReDim Face_ImpSpeed(1 To Number_BdyFace)
  ReDim BdyFace_Angle(1 To Number_BdyFace)
  ReDim Face_MassRate(1 To Number_BdyFace)
  If Number_of_Equa = 0 Then Number_of_Equa = UBound(Face_Erosion, 1)
  ReDim Face_Erosion(1 To Number_of_Equa, 1 To Number_BdyFace)
End Sub


Thank you in advance.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 40328054
I have know idea what you are really working with, but maybe something like this:

public class ErosionImpact
{
   public List<int> FaceImpactSpeed { get; set; }
   private List<int> BodyFaceAngle { get; set; }
   private List<int> FaceMassRate { get; set; }
   private List<int> FaceErosion { get; set; }

   public void ClearErosionAndImpactInfo()
   {
      FaceImpactSpeed.Clear();
      BodyFaceAngle.Clear();
      FaceMassRate.Clear();
      FaceErosion.Clear();
  }

}

Open in new window

0
 

Author Closing Comment

by:mannevenu26
ID: 40329862
ok
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question