-
Recently Browsing 0 members
- No registered users viewing this page.
-
Similar Content
-
- 13 replies
- 818 views
-
Is an iPhone that has the battery replaced by Apple as good as originally from the factory as far as the seals, etc?
By JayZJay,
- iphone battery
- replacement
- (and 1 more)
- 5 replies
- 3,600 views
-
- 23 replies
- 640 views
-
Microsoft Teams is replacing Skype for Business
By Usama Jawad96,
- microsoft teams
- teams
- (and 7 more)
- 17 replies
- 517 views
-
- 1 reply
- 2,477 views
-
Question
xScence
First of all Happy New Year Neowins.
The program gets the following string in db.lib NAME > URL
For Example:
When i start my form loads the whole db.lib file in listbox1 like this:
after that when i double click it will open me http://google.com because i split it with this tag (">")
Dim arg() As String
For i As Integer = 0 To ListBox1.Items.Count
arg = ListBox1.SelectedItem.ToString.Split(">")
Next
[/CODE]
My question is: How can i hide the url addres ("http://") in list box to show only the name Google and when i click it to open http://google.com - Thanks
Btw this program gets the mms: protocol (most used for Online TV) and play it in VLC player.
The whole code:
Imports System.Net
Imports System.IO
Imports System.Web
Public Class Form1
Dim i As Integer
Private Sub ??????ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ??????ToolStripMenuItem.Click
Dim inp As String = InputBox("???? ??? ??????????", "???????", vbOKCancel)
If inp <> "" Then
ListBox1.Items.Add(inp)
End If
End Sub
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
My.Settings.path = Label1.Text
Dim w As New System.IO.StreamWriter("db.lib")
Dim i As Integer
For i = 0 To ListBox1.Items.Count - 1
w.WriteLine(ListBox1.Items.Item(i))
Next
w.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = My.Settings.path
Dim r As New System.IO.StreamReader("db.lib")
While (r.Peek() > -1)
ListBox1.Items.Add(r.ReadLine)
End While
r.Close()
End Sub
Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
Dim Client As New WebClient
Dim arg() As String
For i As Integer = 0 To ListBox1.Items.Count
arg = ListBox1.SelectedItem.ToString.Split(">")
Next
Try
Dim html = Client.DownloadString(New Uri(arg(i + 1)))
Client.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
Try
Dim StartPos As Integer = html.IndexOf("mms")
Dim EndPos As Integer = html.IndexOf("</object>", StartPos)
Dim finaloutcome As String = html.Substring(StartPos, EndPos - StartPos)
Dim Key As String = (finaloutcome.Substring(0, 90))
Dim Last As String = Key.Replace(""">", "")
Dim all As String = Last.Replace("<pa", "")
If Label1.Text = "" Then
MsgBox("Please coose the folder to your VLC Player!")
Else
Shell(Label1.Text & "\vlc.exe " & all)
End If
Catch ex As Exception
MsgBox("This link does not support mms protocol!")
End Try
Catch ex As Exception
MsgBox("I cant connect to the website!")
End Try
End Sub
Private Sub VLCPlayerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VLCPlayerToolStripMenuItem.Click
FolderBrowserDialog1.ShowDialog()
Label1.Text = FolderBrowserDialog1.SelectedPath
My.Settings.path = Label1.Text
My.Settings.Save()
End Sub
End Class
[/CODE]
Link to comment
Share on other sites
16 answers to this question
Recommended Posts