E edm68 Member Licensed User Longtime User May 22, 2017 #1 Hi, I'm trying to use return to pass the result from a code module back to the main module. I see lots of examples on the side that uses return, but can't find any thing on the side that called the sub to get the value back. Hope that makes sense. Maybe I'm just misunderstanding how return works? From my Main module - Code: Sub btn1_Click Dim intA As Int Dim intB As Int intA=edt1.Text intB=edt2.Text Calc1.Add2(intA,intB) 'lbl1.Text= ? End Sub From my code module, named Calc1 - Code: Sub Add2(int1 As Int,int2 As Int) As Int Dim intTotal As Int intTotal=int1+int2 Log(intTotal) Return intTotal End Sub Thanks in advance.
Hi, I'm trying to use return to pass the result from a code module back to the main module. I see lots of examples on the side that uses return, but can't find any thing on the side that called the sub to get the value back. Hope that makes sense. Maybe I'm just misunderstanding how return works? From my Main module - Code: Sub btn1_Click Dim intA As Int Dim intB As Int intA=edt1.Text intB=edt2.Text Calc1.Add2(intA,intB) 'lbl1.Text= ? End Sub From my code module, named Calc1 - Code: Sub Add2(int1 As Int,int2 As Int) As Int Dim intTotal As Int intTotal=int1+int2 Log(intTotal) Return intTotal End Sub Thanks in advance.
R Roycefer Well-Known Member Licensed User Longtime User May 22, 2017 #2 Code: lbl1.Text = Calc1.Add2(intA,intB) Upvote 0
E edm68 Member Licensed User Longtime User May 22, 2017 #3 Thank you so much, that worked. I've been searching all weekend for this. I guess since the examples I saw put a variable after Return, I thought I should look for that? So I put 'intTotal' after Return and that is what I was trying to look for. Upvote 0
Thank you so much, that worked. I've been searching all weekend for this. I guess since the examples I saw put a variable after Return, I thought I should look for that? So I put 'intTotal' after Return and that is what I was trying to look for.