Solved

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

Posted on 2014-09-12
4
178 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now