Load Browser : LinkLabel « GUI « VB.Net Tutorial





Load Browser
Imports System.Windows.Forms

public class LinkLabelAction
   public Shared Sub Main
        Application.Run(New FrmLinkLabel)
   End Sub
End class


Public Class FrmLinkLabel
   Inherits Form

#Region " Windows Form Designer generated code "

   Public Sub New()
      MyBase.New()

      'This call is required by the Windows Form Designer.
      InitializeComponent()

      'Add any initialization after the InitializeComponent() call

   End Sub

   'Form overrides dispose to clean up the component list.
   Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
      If disposing Then
         If Not (components Is Nothing) Then
            components.Dispose()
         End If
      End If
      MyBase.Dispose(disposing)
   End Sub

   ' linklabels to C: drive, www.deitel.com and Notepad
   Friend WithEvents lnklblCDrive As LinkLabel
   Friend WithEvents lnklblDeitel As LinkLabel
   Friend WithEvents lnklblNotepad As LinkLabel

   'Required by the Windows Form Designer
   Private components As System.ComponentModel.Container

   'NOTE: The following procedure is required by the Windows Form Designer
   'It can be modified using the Windows Form Designer.  
   'Do not modify it using the code editor.
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
      Me.lnklblNotepad = New LinkLabel()
      Me.lnklblCDrive = New LinkLabel()
      Me.lnklblDeitel = New LinkLabel()
      Me.SuspendLayout()
      '
      'lnklblNotepad
      '
      Me.lnklblNotepad.Location = New System.Drawing.Point(72, 112)
      Me.lnklblNotepad.Name = "lnklblNotepad"
      Me.lnklblNotepad.Size = New System.Drawing.Size(128, 23)
      Me.lnklblNotepad.TabIndex = 2
      Me.lnklblNotepad.TabStop = True
      Me.lnklblNotepad.Text = "Click to run Notepad"
      '
      'lnklblCDrive
      '
      Me.lnklblCDrive.Location = New System.Drawing.Point(72, 16)
      Me.lnklblCDrive.Name = "lnklblCDrive"
      Me.lnklblCDrive.TabIndex = 0
      Me.lnklblCDrive.TabStop = True
      Me.lnklblCDrive.Text = "Click to browse C:\"
      '
      'lnklblDeitel
      '
      Me.lnklblDeitel.Location = New System.Drawing.Point(72, 64)
      Me.lnklblDeitel.Name = "lnklblDeitel"
      Me.lnklblDeitel.Size = New System.Drawing.Size(152, 23)
      Me.lnklblDeitel.TabIndex = 1
      Me.lnklblDeitel.TabStop = True
      Me.lnklblDeitel.Text = "Click to visit www.java2s.com"
      '
      'FrmLinkLabel
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
      Me.ClientSize = New System.Drawing.Size(264, 149)
      Me.Controls.AddRange(New Control() {Me.lnklblNotepad, Me.lnklblDeitel, Me.lnklblCDrive})
      Me.Name = "FrmLinkLabel"
      Me.Text = "LinkLabelTest"
      Me.ResumeLayout(False)

   End Sub

#End Region

   Private Sub lnklblCDrive_LinkClicked _
      (ByVal sender As System.Object, ByVal e As _
      System.Windows.Forms.LinkLabelLinkClickedEventArgs) _
      Handles lnklblCDrive.LinkClicked

      lnklblCDrive.LinkVisited = True
      System.Diagnostics.Process.Start("C:\")
   End Sub 

   Private Sub lnklblDeitel_LinkClicked _
      (ByVal sender As System.Object, ByVal e As _
      System.Windows.Forms.LinkLabelLinkClickedEventArgs) _
      Handles lnklblDeitel.LinkClicked

      lnklblDeitel.LinkVisited = True
      System.Diagnostics.Process.Start("IExplore", "http://www.java2s.com")
   End Sub ' lnklblDeitel

   ' run application Notepad
   Private Sub lnklblNotepad_LinkClicked _
      (ByVal sender As System.Object, ByVal e As _
      System.Windows.Forms.LinkLabelLinkClickedEventArgs) _
      Handles lnklblNotepad.LinkClicked

      lnklblNotepad.LinkVisited = True

      System.Diagnostics.Process.Start("notepad")
   End Sub 

End Class










14.14.LinkLabel
14.14.1.Get LinkData from LinkLabelGet LinkData from LinkLabel
14.14.2.LinkLabel local actionLinkLabel local action
14.14.3.LinkArea in LinkLabelLinkArea in LinkLabel
14.14.4.Link AddLink Add
14.14.5.Multiple links and generic handlerMultiple links and generic handler
14.14.6.Using LinkLabels to create hyperlinksUsing LinkLabels to create hyperlinks
14.14.7.Load File ExploreLoad File Explore
14.14.8.Load BrowserLoad Browser
14.14.9.Load Window ApplicationLoad Window Application
14.14.10.Set Label Border styleSet Label Border style
14.14.11.Set LinkLabel ImageListSet LinkLabel ImageList
14.14.12.LinkLabel: LinkArea, LinkColor, VisitedLinkColor, ActiveLinkColorLinkLabel: LinkArea, LinkColor, VisitedLinkColor, ActiveLinkColor