[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to convert the code from vba macro excel to c#.net

Posted on 2014-08-24
5
Medium Priority
?
1,914 Views
Last Modified: 2014-08-30
Hi,

Cold you please tell how to change the code from vba macro to c#.net.

Public Function CompareArrays(Array1 As Variant, Array2 As Variant, _
    ResultArray As Variant, Optional CompareMode As VbCompareMethod = vbTextCompare) As Boolean

End Function



iam not able to convert the code. iam getting error like

An error occured converting your code, probably due to a syntax error:
-- line 1 col 8: invalid NonModuleDeclaration
0
Comment
Question by:mannevenu26
  • 3
4 Comments
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 40282729
Use Linq and it could be like:

bool isEqual = array1.SequenceEqual(array2);

/gustav
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 40284093
Great! And you didn't even bother testing as that creates the error reported by the questioneer because this is VBA, not VB.NET.

/gustav
0
 

Author Comment

by:mannevenu26
ID: 40284923
@Gustav Brock,

What you commented above it is not related my question.
When iam converting the code i got error that was mention above.please suggest if you have any idea.Please let me know.

Thanks you.

Hi friends,
 
this function should be convert from vab code to c#.net.Please suggest if any body have idea.Please let me know.
Public Function CompareArrays
                       (Array1 As Variant,
                        Array2 As Variant,
                        ResultArray As Variant,
                        Optional CompareMode As VbCompareMethod = vbTextCompare
                        ) As Boolean
End Function


Thank you inadvance. :)
0
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 1000 total points
ID: 40284999
My first comment is a method to compare two arrays which is what you ask for.

The second comment is related to a useless post now deleted.

/gustav
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

872 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