DotNetWebTutor.com                                                    Link to Us

Label Control
Mostly used for read only static display of text using its text property

Autosize property lets the text resize itself automatically
Textalign-align text in label

Use a label control to define an access code for another control
Example:

  • Drag a label to your form
  • Set the text property and precede the access key with an (&) ampersand
  • Set the UseMnemonic property to true
  • Set the tab index to one less than the tab index of the control you want to get access

vb linklabel control
LinkLabel Control
Allows you to make a hyperlink in your form to open a web page or do some other action
Properties

Handle linkClicked event
Set linkVisited to true in this event

Example to set linkvisited to true and open browser
e.LinkVisited=true
System.Diagnostics.Process.Start(“Http://www.learn-asp.net”)

  • activeLinkColor
    • Color of active links
  • LinkColor
    • Color of the link
  • LinkVisited
    • If link has been visited
  • VisitedLinkColor
    • Color of visited links
  • LinkBehavior
    • 4 possible values
      • systemDefault
      • AlwaysUnderline
      • HoverUnderline
      • NeverUnderline

Example:

  • Create a project with 2 forms
  • Name the second form newForm
  • Add linklabel
  • Set text property
  • Double click linklabel to get to the default event
  • Add this code:

newForm.show()
system.diagnostics.Process.Start(“www.starkstate.edu”)
linklabel1.linkvisited=true
vb richtextbox control
RichTextBox
Allows Bold, Italic and the ability to add pictures
Provides loadfile() and savefile() to save contents as RTF document
Selection properties

  • Selectedtext
  • SelectionLength
  • SelectionStart
  • SelectionColor
  • SelectionBackColor
  • SelectionFont
  • SelectionAlignment

example
richtextbox1.SelectionColor=Colors.Red

enableAutodragDrop- allows you to drag selections to different parts of documents

selectionChanged event

To place an image inside a richtextbox use the copy and paste features of clipboard

  • Copy to clipboard
  • Move to desires position in textbox and paste it

Dim img as image=image.fromfile(Path.combine(Application.startupPath,”Picture.jpg”))
Clipboard.setimage(img)
Richtextbox1.selectionstart=0
Richtextbox1.paste()
Clipboard.clear()
vb picturebox control
PictureBox
Pic.image=system.drawing.image.fromfile(“mypicture.jpg”)
Pic.sizemode=pictureboxsizemode.stretchimage
vb label control