flann Posted September 20, 2005 Posted September 20, 2005 I'm trying to use functions, I'm still pretty new to this. I have two function calls going to two different functions. No matter which one I call first, only the first one will work, not the second. I've switched them around and its always which ever one I put first that works. Any thoughts? lblQualify.Text = CalADPSPayOffDate(CreditorNameArray, BalanceArray, MinMoArray, PctArray, PriorityArray, numRecs, accMargin, totalIncome) lblQualify.Text = Format(lblQualify.Text, "fixed") lblPlusQualify.Text = CalADPSPlusPayOffDate(CreditorNameArray, BalanceArray, MinMoArray, PctArray, PriorityArray, numRecs, curADPSPlusAccMargin, totalIncome) lblPlusQualify.Text = Format(lblPlusQualify.Text, "fixed") Quote Flann Mortgage Calculator | Debt Free Credit Card Debt | Filing Bankruptcy
Administrators PlausiblyDamp Posted September 20, 2005 Administrators Posted September 20, 2005 Do you get any errors generated? If you step through the code in the debugger what happens? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
flann Posted September 20, 2005 Author Posted September 20, 2005 Do you get any errors generated? If you step through the code in the debugger what happens? When I debug I don't get any errors, and the first call has a value, the second call is 0. That is what happens no matter which one comes first, its always the first one to get the value and the second doesn't. I'm stumped :( Quote Flann Mortgage Calculator | Debt Free Credit Card Debt | Filing Bankruptcy
Administrators PlausiblyDamp Posted September 20, 2005 Administrators Posted September 20, 2005 Try putting Option Strict On at the top of the source file and fix any errors it throws up, also could you post the code for the 2 functions themseleves? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
flann Posted September 20, 2005 Author Posted September 20, 2005 Try putting Option Strict On at the top of the source file and fix any errors it throws up' date=' also could you post the code for the 2 functions themseleves?[/quote'] It still didn't work, I would love to be able to post the function, but its a company calculation, and I signed a contract stating that I can't do that. Has this ever happen to you before? Quote Flann Mortgage Calculator | Debt Free Credit Card Debt | Filing Bankruptcy
flann Posted September 20, 2005 Author Posted September 20, 2005 I added a watch to the two calls, and this is what they both say. Argument not specified for parameter 'CreditorName' of 'Public Funtion CalADPSPayOffDate...... What does this mean? Quote Flann Mortgage Calculator | Debt Free Credit Card Debt | Filing Bankruptcy
Administrators PlausiblyDamp Posted September 20, 2005 Administrators Posted September 20, 2005 could you post the declaration for the two functions then? Also when you say the second call is 0 do you mean it returns 0? If so are the parameters you passing in correct? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
flann Posted September 20, 2005 Author Posted September 20, 2005 could you post the declaration for the two functions then? Also when you say the second call is 0 do you mean it returns 0? If so are the parameters you passing in correct? Yes the second one always returns 0, and yes I'm passing it the correct parameters. Function CalADPSPlusPayOffDate(ByVal CreditorName() As String, ByVal Balances() As Double, ByVal MinPymt() As Double, ByVal Pct() As Double, ByVal Priority() As Double, ByVal NumRecs As Integer, ByVal StartAccMargin As Double, ByVal curCombIncome As Double) As String This is the same for both of them. Quote Flann Mortgage Calculator | Debt Free Credit Card Debt | Filing Bankruptcy
Administrators PlausiblyDamp Posted September 20, 2005 Administrators Posted September 20, 2005 Does either function change any of the values in the arrays passed in? If so that is possibly a cause of the problem Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
flann Posted September 20, 2005 Author Posted September 20, 2005 Does either function change any of the values in the arrays passed in? If so that is possibly a cause of the problem That's it, it changed the values. Thank you Quote Flann Mortgage Calculator | Debt Free Credit Card Debt | Filing Bankruptcy
flann Posted September 20, 2005 Author Posted September 20, 2005 Now i'm trying to put the values of the arrays into different arrays for the second call. All the arrays are getting zero'd out after the function. Dim BalanceArrayPlus() As Double = BalanceArray Dim MinMoArrayPlus() As Double = MinMoArray Dim PctArrayPlus() As Double = PctArray Dim PriorityArrayPlus() As Double = PriorityArray lblQualify.Text = CalADPSPayOffDate(CreditorNameArray, BalanceArray, MinMoArray, PctArray, PriorityArray, numRecs, accMargin, totalIncome) lblQualify.Text = Format(lblQualify.Text, "fixed") lblPlusQualify.Text = CalADPSPlusPayOffDate(CreditorNameArray, BalanceArrayPlus, MinMoArrayPlus, PctArrayPlus, PriorityArrayPlus, numRecs, curADPSPlusAccMargin, totalIncome) lblPlusQualify.Text = Format(lblPlusQualify.Text, "fixed") Quote Flann Mortgage Calculator | Debt Free Credit Card Debt | Filing Bankruptcy
Administrators PlausiblyDamp Posted September 20, 2005 Administrators Posted September 20, 2005 Arrays are reference types, the code Dim BalanceArrayPlus() As Double = BalanceArray simply creates another variable that points to the same array in memory. IIRC you will need to look at Array.Copy(...) to perform a deep copy of the array. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.