?
Solved

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

Posted on 2014-09-12
4
Medium Priority
?
186 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 1500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

718 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