Hi, Im trying to make an order for an invoice that will take in some details like name, number and have an array of product details like price, qty. It uses variables used in class mods. See if you can make sense of this.
Dim NewOrder As New struct_XOrder
Dim LineItems(1 To 2) As New struct_LineItem
NewOrder.ClientShortName = "DemoClient"
NewOrder.OrderNumber = "12345"
LineItems(1).Qty = 5
LineItems(1).ItemComment = "comment1"
'LineItems(2).Qty = 10
'LineItems(2).ItemComment = "comment2"
'''''''''''' Sample C# code - trying to replicate
NewOrder.LineItems = new LineItem; // initialize to correct number of line items
XLine = new LineItem(); // create a new line item
XLine.ClientShortName = "abcde"; // populate it
XLine.Qty = 5;
NewOrder.LineItems = XLine; // place it to the array
XLine = new LineItem(); // and so on
XLine.Qty = 10;
Xline.ClientShortName = "test";
NewOrder.LineItems = XLine;
First off are you in the right forum? Your code looks like VB.net not VB6. Secondly, if this is VB.net then, I'd use nested classes and lists instead of arrays. List work much the same with one important aspect, they are more dynamic and support growing and shrinking as items are added or removed.
If it's vba this is the right place. But you're facing an uphill battle here. C# is accessing the worksheet in a different manner than you will. Basically you want to design the form in excel first then access the parts of the form using the Worksheet object.
Unless you specifically need features of excel, that are hard to duplicate, you might be better off using a series of forms in .net.