![]() |
|
[.NET] Open links one by one in webbrowser and save in the TextBox line by line - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Open links one by one in webbrowser and save in the TextBox line by line (/showthread.php?tid=4650992) |
Open links one by one in webbrowser and save in the TextBox line by line - nezinau - Jan 23, 2015 Hello HF, I am trying to make a little application which opens imported links and then simply searches for specific text. If text haven't been found - then drop that link in another multi line textbox. I was able to make it till this point, but I am not able to make it run multiple links. For example, I am able to run only one line, but not able to enter any more lines - just one, because then it doesn't work. Can anyone help me go though each one link in the webbrowser and then paste ones, whom text was not founded in another multi line textbox without overwriting first line? I am using this for saving link - TextBox2.Text = WebBrowser1.Url.ToString Thanks, i hope someone could help me out there. here's the whole code: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load WebBrowser1.Navigate("someforum") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ofd As New OpenFileDialog() ofd.Filter = "Text Files (*.txt)|*.txt" 'used for importing links If (ofd.ShowDialog() = Windows.Forms.DialogResult.OK) Then Dim sr As New System.IO.StreamReader(ofd.FileName) TextBox1.Text = sr.ReadToEnd() sr.Close() Dim count As Integer = TextBox1.Lines.Length Label19.Text = count.ToString() 'counts number of imported links to check End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click WebBrowser1.Navigate(TextBox1.Text) 'opens imported link in webbrowser. not sure if this is the way to do it if I want to go thought like 100 lines Delay(2) If Me.WebBrowser1.DocumentText.Contains("textiwanttofind") Then MsgBox("Successfully found!") 'does nothing if text has been found. just displays msgbox Else TextBox2.Text = WebBrowser1.Url.ToString 'saves to another textbox if specific text was not found End If * - Odus - Jan 23, 2015 You're going about this wrong. Web requests can do this way faster - even more so when threaded. * - nezinau - Jan 23, 2015 (Jan 23, 2015 01:26 PM)Odus Wrote: You're going about this wrong. Web requests can do this way faster - even more so when threaded. You are right- but I don't really care about the speed - I just wan't to get the thing done. But thanks for the suggestion. Do you have any ideas on how I could fix problems described in the OP? thanks. |