M
maria
Hi all
I used to work with VB, and now I am trying C# and can't get it start for
example in VB
Dim Items() as tItems
dim NumberOfitems as long
obj.GetAllItems(NumberOfitems, Items())
for i=0 to NumberOfitems
y=Items(i).ID
x=Items(i).Name
next
in C#:
using ComObj;
ComObj.clsObj object = new ComObj.clsObj();
ComObj.clsObj obj = object;
ComObj.tItems Items= new tItems();
int NumberOfitems;
obj.GetAllItems(ref NumberOfitems, ref Items())
When I build it gives me an error in Error List:
1.Items is a 'variable' but it used like a 'method'.
If I will change function called this way:
obj.GetAllItems(ref NumberOfitems, ref (Array) Items())
the output error is :
1. can not convert type ComObj.tItems to System.Array.
2. Argument 2 must be passed with ref keyword
3. The best overloaded method match for ComObj.clsObj.GetAllItems(ref int,
ref System.Array) has some invalid arguments.
If anyone has an idea on how I should declare the Items() that it will be
recognized as array, or any idea how to handle this script please replay.
Any help is greatly appreciated.
I used to work with VB, and now I am trying C# and can't get it start for
example in VB
Dim Items() as tItems
dim NumberOfitems as long
obj.GetAllItems(NumberOfitems, Items())
for i=0 to NumberOfitems
y=Items(i).ID
x=Items(i).Name
next
in C#:
using ComObj;
ComObj.clsObj object = new ComObj.clsObj();
ComObj.clsObj obj = object;
ComObj.tItems Items= new tItems();
int NumberOfitems;
obj.GetAllItems(ref NumberOfitems, ref Items())
When I build it gives me an error in Error List:
1.Items is a 'variable' but it used like a 'method'.
If I will change function called this way:
obj.GetAllItems(ref NumberOfitems, ref (Array) Items())
the output error is :
1. can not convert type ComObj.tItems to System.Array.
2. Argument 2 must be passed with ref keyword
3. The best overloaded method match for ComObj.clsObj.GetAllItems(ref int,
ref System.Array) has some invalid arguments.
If anyone has an idea on how I should declare the Items() that it will be
recognized as array, or any idea how to handle this script please replay.
Any help is greatly appreciated.