Link to home
Start Free TrialLog in
Avatar of BlakeMcKenna
BlakeMcKennaFlag for United States of America

asked on

Values aren't being returned in Sub-Procedure

I have a two subroutines where one calls the other and passes 2 parameters, however, on return, the parameters are empty and I'm not sure what I'm doing wrong.

Here are the two Sub Routines:

    Private Sub usrResistanceCreep_ResistanceButton() Handles usrResistanceCreep.ResistanceButton
        'Debug.Print("usrResistanceCreep_ResistanceButton")

        Try
            Dim strRin As String = String.Empty
            Dim strRout As String = String.Empty

            EH.ErrorMessage = String.Empty

            CheckTestRinRout(strRin, strRout)

            If strRin.Length > 0 Then
                usrResistanceCreep.txtRIn.Text = Format(CDec(strRin), "#####0.####")
            End If

            If strRout.Length > 0 Then
                usrResistanceCreep.txtROut.Text = Format(CDec(strRout), "#####0.####")
            End If

        Catch ex As Exception
            EH.ErrorMessage = "frmCalibration_3/usrResistanceCreep_ResistanceButton() - " & ex.Message & "...Contact Engineering!" & "~E"
        End Try

        EH.ProcessMessages(Me, sbr, EH.ErrorMessage)
    End Sub
    '
    '
    '
    Public Sub CheckTestRinRout(ByVal strRIn As String, ByVal strROut As String)
        'Debug.Print("CheckTestRinRout")

        Try
            EH.ErrorMessage = String.Empty

            strMessage = "Acquiring Resistance In / Resistance Out values!"
            mlStatusMessage.Text = strMessage

            strRIn = String.Empty
            strRout = String.Empty

            Application.DoEvents()

            InitializeErrorClass(EH)
            ReadRin(RealReadMode, 0, EH)
            If EH.ErrorMessage = String.Empty Then
                strRIn = CStr(GetDecimalPlaces(CStr(EH.sSingle), gLoadDecimalPlaces))
            Else
                GoTo ProcessMessage
            End If

            If blnGetRout Then
                blnGetRout = False

                ReadRout(RealReadMode, 0, EH)

                If EH.ErrorMessage = String.Empty Then
                    strRout = CStr(GetDecimalPlaces(CStr(EH.sSingle), gLoadDecimalPlaces))
                End If
            End If

            If strRIn.Length > 0 And strRout.Length > 0 Then
                blnResiTestComplete = True

                If AreTestsComplete2() Then
                    btnSaveTestLoad.Focus()
                End If
            End If

            mlStatusMessage.Text = String.Empty

ProcessMessage:

        Catch ex As Exception
            EH.ErrorMessage = "frmCalibration_3/CheckTestRinRout() - " & ex.Message & "...Contact Engineering!" & "~E"
        End Try
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ElrondCT
ElrondCT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BlakeMcKenna

ASKER

ElronCT, that worked great! I've used ByRef before but wasn't sure if that would take care of it. I should have tried it before posting!

Thank you!