How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Chris Baxter Your Own Question

Chris Baxter
Chris Baxter, Programming Tutor
Category: Programming
Satisfied Customers: 246
Experience:  Completed BSIT concentration Software Engineering, tutored other students and classmates in Java and, C++, and Obj C.
Type Your Programming Question Here...
Chris Baxter is online now
A new question is answered every 9 seconds

I am writing VB code to CreateLine function. How can I pass

Customer Question

I am writing VB code to CreateLine function. How can I pass the value to
this script and create 2nd, 3rd line, etc. (depends on how many line in Invoice)?
calc.AddLine(CreateLine(50, "1", "1", "EA"))
calc.AddLine(CreateLine(100, "2", "1", "EA"))
Private Function CreateLine(ByVal grossAmount As Integer, ByVal LineNumber As String, ByVal Quantity As Integer, ByVal UOM As String) As ILineInfo
Dim Line As LineInfo
Dim inv As InvoiceItem
Line = New LineInfo
inv = New InvoiceItem
Line.GrossAmount = Convert.ToString(inv.extended_price)
Line.LineNumber = inv.line_number '(will have multiple lines)
I am new VB programer and thank you for the help.
Submitted: 1 year ago.
Category: Programming
Expert:  Ingo U replied 1 year ago.

Sometimes pasting formatted data directly into this site doesn't
render as you'd expect, and can become difficult to read.
I'm not sure I got all the information correctly and completely.
Could you please upload any files related to this project to
(or a file sharing site of your choice) so I may have a look?
If there are multiple files, it's easiest to put them in a compressed (zipped)
folder and upload just that one item.

Ingo U

PS If you're not familiar with wikisend, it's easy and free:
Go to and upload the file there (no need to sign up).
You will then get a page that has the File ID and Download Link.
Copy either the File ID or the Download Link and come back here and paste it in your reply.

Customer: replied 1 year ago.
Hello,I have upload the file ID 976634
Expert:  Ingo U replied 1 year ago.

I'm sorry,
After reviewing the question, I regret that I won't be able to assist you at this time.

I am opting out and opening the question up to other professionals here who may be able to help.

Ingo U

Customer: replied 1 year ago.
What I have now for the line items is hard code, but is not want I want. The values need to be passed through InvoiceItem
calc.AddLine(CreateLine(50, "1", "1", "EA"))
calc.AddLine(CreateLine(100, "2", "1", "EA"))
Expert:  Chris Baxter replied 1 year ago.

Have you tried to loop this?


For each line in lineArray()

<to do code here>

Next line

where your to do code is roughly:

dim lineIncrement as Integer = 50

dim linenumber as String = Line.LineNumber?

calc.AddLine(CreateLine(lineIncrement, lineNumber, "1", "EA"))

lineIncrement = lineIncrement + 50