I created a form with a single scroll view with the background set to Color.White.
It dynamically adds URLLabels with the Tooltip set to display the actual hyperlink and a short description.
This data is contained in a small txt file (Links.Txt) in a format of:
Displayed Name | HyperLink | Short Description.
Clicking on any URLLabel opens the default browser with the address coming from URLLabel.Link.
The order of display is the order in which the lines of the file is read.
Form Code as below.
' Gambas class file
Private NewLink As URLLabel
Private TmpAry As String[]
Public Sub Form_Open()
Dim Buffer As Integer = 3
Dim FileName As String = Application.Path &/ "Links.Txt" '{Change this for the actual location of the file}
Dim LinkFile As File
Dim TmpLine As String = ""
Dim TmpInt as Integer = 0 ' <----<< This code was missing from the Original Post. (Edit)
Dim Ylocation As Integer = Buffer
Dim SetOdd As Boolean = True
Scv_Links.Width = Me.Width - 10
Scv_Links.Height = Me.Height - 10
If Exist(FileName) Then
Scv_Links.Children.Clear
LinkFile = Open FileName For Input
While Not Eof(LinkFile)
Line Input #LinkFile, TmpLine
If ((Left(TmpLine, 1) <> "#") Or (Trim(TmpLine) <> "")) Then
TmpAry = Split(TmpLine, "|")
If TmpAry.Count = 3 Then
NewLink = New URLLabel(Scv_Links) As "Link#" & Str(TmpInt)
NewLink.Text = TmpAry[0]
NewLink.Link = TmpAry[1]
NewLink.Tooltip = TmpAry[1] & Gb.CrLf & TmpAry[2]
NewLink.Height = 24
NewLink.Width = Scv_Links.Width - 25
NewLink.Left = 5
NewLink.Top = YLocation
YLocation += Buffer + NewLink.Height
If SetOdd Then
NewLink.Background = Color.RGB(195, 223, 223)
SetOdd = False
Else
NewLink.Background = Color.RGB(255, 255, 223)
SetOdd = True
Endif
NewLink.Foreground = Color.LinkForeground
Endif
Endif
Wend
Endif
End
Public Sub Form_KeyPress()
If Key.Code = Key.Esc Then Me.Close
End