how to filter textbox text?
i use this code to copy webbrowser text in textbox3

TextBox3.Text = WebBrowser1.Document.Body.InnerText

it show all text in textbox like this

crypo.freeforums.org 
Advanced search  Board index ‹ Socks Change font size E-mail friendPrint view User Control Panel (0 new messages) • View your posts Arcade Chat FAQ Members Logout [ crypo ] 
[ Moderator Control Panel ]
Sockz 6:04am update
Post a reply     1 post • Page 1 of 1 
Edit postDelete postReport this postInformationReply with quote Sockz 6:04am update
by crypo » 16 Apr 2012, 20:36 
174.61.58.121:1423
109.121.229.2:36931
76.127.121.123:15015
68.44.110.121:33683
72.188.77.73:6757
184.58.129.218:1467
98.220.58.56:1885
95.168.173.29:36649
216.110.254.35:22887
69.142.132.31:41409
62.205.232.61:8917

i want to filter this text

just want to show these items in text box

how to do that any help?

109.121.229.2:36931
76.127.121.123:15015
68.44.110.121:33683
72.188.77.73:6757
184.58.129.218:1467
98.220.58.56:1885
95.168.173.29:36649
216.110.254.35:22887
69.142.132.31:41409
62.205.232.61:8917

Recommended Answers

All 5 Replies

You could do something like this (that works on this very posting):

Imports System.Net
Imports System.IO
Imports System.Text.RegularExpressions

Module Module1

   Sub Main()
      Dim rxIpAndPort As New Regex("(?<ip_and_port>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5})")
      Dim wc As New WebClient
      Dim fileInFile As New StreamReader(wc.OpenRead("http://www.daniweb.com/software-development/vbnet/threads/422678/filter-textbox-text"))
      Dim arr_strData = fileInFile.ReadToEnd() _
         .Split((Chr(10) + Chr(13) + "<> ") _
         .ToCharArray(), StringSplitOptions.RemoveEmptyEntries) _
         .Where(Function(s) rxIpAndPort.IsMatch(s)) _
         .Select(Function(s) rxIpAndPort.Match(s).Groups("ip_and_port").Value) _
         .Distinct() _
         .ToArray()
      fileInFile.Close()

      ' TextBox3.Text = String.Join(Environment.NewLine, arr_strData)
      System.Diagnostics.Debug.WriteLine(String.Join(Environment.NewLine, arr_strData))
   End Sub

End Module

no link involved

i load text in to text box then press 1 button to filter not grabbing from some link

That was just an example. You can parse your text the same way from the text box.
Like TextBox3.Text = TextBox3.Text.Split((Chr(10) ... 'and so on...'

still not understandin

i load text in textbox from 1 text file

then i filter it

in example u showed u grabbing from link

am trying to learn and help my self so new things not understandable for me

Then the first example will work.
Instead of opening a StreamReader to a web page, open that same StreamReader to your text file.

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.