-1

I have an assignment in Visual basic I don't know how to do. I am to create 2 sub routines and 1 function that send values back to main calling program. The main program populates the combobox and displays information in the listbox and that is all.

The first sub takes a selected entry from the combobox which is Name and ID. The sub does the calculation and sends Name, ID, and Calculated Value back to calling program.

My question is how do I send these 3 values back to the main calling program? I am assuming there is no byRef. I apologize in advance if this is not a unique question but I haven't been able to find an answer. Thank you.

BJ Myers
  • 6,617
  • 6
  • 34
  • 50
  • Make all three functions – Jesse Mar 17 '13 at 19:13
  • I am not allowed to, it has to be a sub –  Mar 17 '13 at 19:14
  • And those three values have to be returned in one sub –  Mar 17 '13 at 19:14
  • It sounds like you only need to return Calculated Value form your function. The calling code would already have access to Name and ID. – shf301 Mar 17 '13 at 19:16
  • How do I send the calculated Value though? –  Mar 17 '13 at 19:18
  • And I have to send the three values so the program knows what one was selected so it can send appropriate information to the other sub and function –  Mar 17 '13 at 19:19
  • Why would you assume there is no ByRef? If you want to get a value back from a Sub, then you would have to use ByRef. The Function can just return the value using the Return statement. – Chris Dunaway Mar 18 '13 at 15:59

2 Answers2

1

Assuming by "my assignment", you are talking about school, I would assume the point of the assignment is for you to learn and understand passing parameters to subroutines. In that case, please read up on ByVal vs ByRef.

scott.korin
  • 2,537
  • 2
  • 23
  • 36
0

You can create a class with three properties and pass that around.

David Osborne
  • 6,436
  • 1
  • 21
  • 35
  • I haven't learnt either of those things yet. He also said we aren't allow to use any class variables so I don't know if that's ruled out. –  Mar 17 '13 at 21:48