-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWebLinksGrabber.vb
48 lines (47 loc) · 1.98 KB
/
WebLinksGrabber.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Imports System.IO
Public Class WebLinksGrabber
Dim FrmWebbrowser As FrmWebBrowser
Private Sub ListBox1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles ListBox1.MouseDoubleClick
FrmWebbrowser.GoUrl(ListBox1.SelectedItem.ToString())
End Sub
Public Sub UpdateTextFileAs(ByRef Path As String, ByVal FileName As String, ByRef _text As String)
Dim PathName As String = Path & FileName
Try
If File.Exists(PathName) = True Then File.Create(PathName).Dispose()
Dim alltext As String = _text
File.AppendAllText(PathName, alltext)
Catch ex As Exception
End Try
End Sub
Public Sub SaveTextFileAs(ByRef Path As String, ByVal FileName As String, ByRef _text As String)
Dim PathName As String = Path & FileName
Try
If File.Exists(PathName) = True Then File.Create(PathName).Dispose()
Dim alltext As String = _text
File.WriteAllText(PathName, alltext)
Catch ex As Exception
End Try
End Sub
Public Sub UpdateLinks()
Dim TextLinks As String = ""
For Each Link As String In ListBox1.SelectedItems
TextLinks = TextLinks & Link & vbCrLf
Next
UpdateTextFileAs(Application.StartupPath, "\Weblinks.txt", TextLinks)
End Sub
Private Sub CmdSaveLinks_Click(sender As Object, e As EventArgs) Handles CmdSaveLinks.Click
Dim TextLinks As String = ""
For Each Link As String In ListBox1.SelectedItems
TextLinks = TextLinks & Link & vbCrLf
Next
Dim filename As String = InputBox("Enter Filename :", "Save Link List as", "*.TXT")
Dim path As String = Application.StartupPath & "\" & filename
Try
If File.Exists(path) = True Then File.Create(path).Dispose()
Dim alltext As String = TextLinks
File.WriteAllText(path, alltext)
Catch ex As Exception
End Try
UpdateLinks()
End Sub
End Class