Hi all,
I have a little problem with one application that i'm making.
I've a text file with lots of links to be opened in default browser. I read the file and open the links with a delay of 5 seconds between links.
My problem is that it will open a new link in a new tab of default browser, and i would like to use the same tab to open all links and when it finishes reading the links on text file close that tab.
My code is the following:
Thanks.
I have a little problem with one application that i'm making.
I've a text file with lots of links to be opened in default browser. I read the file and open the links with a delay of 5 seconds between links.
My problem is that it will open a new link in a new tab of default browser, and i would like to use the same tab to open all links and when it finishes reading the links on text file close that tab.
My code is the following:
VB.NET:
Private Sub OpenLinkBtn_Click(sender As Object, e As EventArgs) Handles OpenLinkBtn.Click
Dim FicheiroIn As FileStream
Dim StreamLeitura As StreamReader
Dim LinhaIn As String
Dim Nlinhas As Integer
Nlinhas = 0
FicheiroIn = New FileStream(SelectFileTxt.Text, FileMode.Open, FileAccess.Read, FileShare.Read)
StreamLeitura = New StreamReader(FicheiroIn, System.Text.Encoding.Default)
StreamLeitura.BaseStream.Seek(0, SeekOrigin.Begin)
Do While StreamLeitura.Peek > -1
LinhaIn = StreamLeitura.ReadLine
Process.Start(LinhaIn)
System.Threading.Thread.Sleep(5000)
Nlinhas = Nlinhas + 1
Loop
MessageBox.Show(Convert.ToString(Nlinhas) + " Links Opened")
StreamLeitura.Close()
FicheiroIn.Close()
End Sub