I am needing to know how to translate the VarArrayCreate method in Delphi into c#. Let me step back and explain the scenario
I am in the process of converting a Delphi program over to C#. The ActiveX component is Tidestone's F1Book spreadsheet that was developed prior to the .Net craze. And, of course is no longer available for windows. The .Net environment created a COM wrapper around this ActiveX component so that the method calls are very similar, but not quite..
This one method that used a variant parameter now takes an object parameter
Here is the Delphi code..
procedure tAmortizationReport.CreateSummary
va
VA: Variant
begi
with fSS d
begi
VA := VarArrayCreate([0,1], varSmallInt)
VA[0] := -3;
VA[1] := 4;
SORT(5, 1, 100, 10, True, VA)
end
..
end
Where the SORT method has this variant parameter, and in this case, a variant array
The .NET translation for the SORT method looks like this...
Sort(int row1, int col1, int row2, int col2, bool rowSort, object Keys
I used the following assignment that I thought closely resembled the VarArrayCreate method in Delphi
object[] colstoSort = new object[2] {1,2}
I have tried many different types of assignments to the object Keys parameter, but each returns the following error..
************** Exception Text *************
System.Runtime.InteropServices.COMException (0x800A4E22): Invalid argument
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData
at TTF160.IF1Book.Sort(Int32 nR1, Int32 nC1, Int32 nR2, Int32 nC2, Boolean bSortByRows, Object Keys
Can anyone fill me in as to what I am doing wrong
Also, is there another component that I may use instead of Tidestones? I need to use one that allows the spreadsheet to be owned by the form. I don't know how to do this with Excel
Mattias Sj?gren - 06 Jun 2004 00:20 GMT
Bill,
Have you tried
object colstoSort = new short[] {1,2};
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Bill Gaddis - 07 Jun 2004 00:32 GMT
Perfect....thank you very much