Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27209

[RESOLVED] How to pass an array number AND a variable?

$
0
0
If I have an array that a function uses, how can I pass it a variable and get back the output depending on which array # I pass it as well?

E.G.

Code:

Public Function GetInfo(ByVal pstrMyVariable As String) As String()
        Dim strSomeOutput = GetOutputFunction(pstrMyVariable)
        For Each strLine As String In strSomeOutput.Split(ControlChars.Lf)
            If strLine.Length > 0 Then
                Dim arrLine() As String
                arrLine = strLine.Split(","c)
                Return arrLine
            End If
        Next
        Return Nothing
End Function

    Private Sub btnClick_Click(sender As Object, e As EventArgs) Handles btnClick.Click
        Dim strMyVariable As String = txtRandom.Text
        decSomeDecimal = GetInfo(strMyVariable) 'and here is where I want to pass an array # also
    End Sub

So if I want JUST the data from the first array, how can I set that parameter in my click event?

Viewing all articles
Browse latest Browse all 27209

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>