Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WPF - Tooltips for ComboBox items 5 35
DateTimepicker 4 33
Convert an ASPX page into PDF 7 24
WCF Service Application cannot connect from TCP terminal 1 13
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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

25 Experts available now in Live!

Get 1:1 Help Now