I am trying to move a match from a match collection to another listbox as string. here is my regex code

Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://localhost/pos/leftpanel.html")
        Dim response As System.Net.HttpWebResponse = request.GetResponse

        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())

        Dim rssourcecode As String = sr.ReadToEnd

Dim r As New System.Text.RegularExpressions.Regex("http://localhost/booksmodule/ListContent.php?case=.*&funcfor=.*&funcmod=.*&catid=LM3334443&refid=.*&ccshowid=.*")


Dim matches As MatchCollection = r.Matches(rssourcecode)


        For Each itemcode As Match In matches

            ListBox1.Items.Add(itemcode)

        Next

I want to copy the listbox1 items that are added as match to another listbox which is listbox2 as string instead of match

codeorder commented: well written post +1

If you were getting the Conversion from type 'Match' to type 'String' is not valid. , you just needed to get the .Value of the Match .

For Each itemcode As Match In matches
            ListBox1.Items.Add(itemcode.Value)
        Next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.