1

I am pretty new with VB so this might be a simple question, but I've struggled for a couple of days now. I have created a VB COM object that I am using in my ASP page and I have figured out how I can return individual values from a function, but I would also like to be able to return a list of values, such as order lines.

I have a sample that I have been looking at where the values are retrieved in the following manner in the ASP page.

    Set OrderData = Server.CreateObject("OrderObj.OrderObject")        

    Set Orders = OrderData.LstHeaders

    'List all order rows for a specific Customer
    rows = Orders.LstRows(CustomerNo)

  For n = 1 to rows

    'Write a record for each row
    Response.write Orders.Lines.line(n).item("Item")
    Response.write Orders.Lines.line(n).item("Qty")

  Next 

However, I do not have the code from the COM object that was used and I am just trying to figure out how the code would look like to achieve this same functionality? I tried to create a Public Array the COM object to access via myServer.array(i), but that did not seem to work.

I don't expect anyone to write the entire code for me, I just need some hints on how the general structure of the COM object code should look like to be able to call it like above.

Any ideas or solutions to this would be much appreciated. I have ordered a VB.NET reference manual, but it won't arrive until 2 more weeks and I just can't get any sleep until I worked this out.

6
  • What is the return type of LstRows? Are you returning ArrayList or a COM exposable collection class for the orders? Hit me up on gmail if you need any help outside of this question. Commented Mar 27, 2013 at 11:14
  • Thanks for your quick response Jeremy. I don't actually have the COM code, but I assume LstRows populates an array in the COM object and returns the number of rows. The array is then accessible through 'Orders.Lines'? I just don't know what 'Order.Lines' is? Is it a function that returns an array? How would that be defined? Commented Mar 27, 2013 at 12:31
  • What does TypeName say it is? w3schools.com/vbscript/func_typename.asp Commented Mar 28, 2013 at 0:23
  • I can't really see how that is relevant? It is obviously an Integer or a Long, since it is used to control the loop. I am interested in the 'Orders.Lines.line(n).item("Item")' part. How is 'Lines' defined in the COM object? As a multi-dimensional array? Commented Mar 28, 2013 at 2:09
  • Yes I mean use TypeName on Orders.Lines and Orders.Loines.Line(0) etc Commented Mar 28, 2013 at 2:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.