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

VS 2010 [RESOLVED] Returning 2 values via function

$
0
0
Hi Guys,

What i'm doing here is calling a function that uses regex to search a page for values, using the following code:

Code:

    Private Function returnCF(ByVal html As String) As String

        Dim newValue As String = String.Empty

        '// SET THE PATTERN
        Dim pattern As String = "13pt;""><b>(.*)"
        Dim rx As New Regex(pattern, RegexOptions.IgnoreCase Or RegexOptions.Compiled)

        '// LOOP THE MATCHES OUT
        Dim mc As MatchCollection = Regex.Matches(html, pattern)
        For Each m In mc

            '// CLEAN UP
            Dim splitFlow As String() = m.ToString.Split(">"c)

            newValue = splitFlow(2)

            messagebox.show(splitFlow(2).tostring) <-- This pops up both values that i need.

        Next

        Return newValue

    End Function


I call it like:

Code:

Dim CF As String = returnCF(html)
And then add it to a listbox like:

Code:

ListBoxMain.Items.Add(CF)
I can messagebox.show the results out fine in the function but only 1 value is returned when i do Return newValue instead of 2, so 2 matches are found each run but only 1 returned i cannot think of how to do it!

any help would be great guys

cheers

Graham

Viewing all articles
Browse latest Browse all 27214

Trending Articles



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