0% found this document useful (0 votes)
33 views11 pages

Scroll Bar Functionality in Forms

This document contains code for a Windows form application that uses various controls like track bars, scroll bars, month calendar, progress bar, link label, timer, tool tips, combo box, check box list, and list box. The code handles events for these controls to update other controls on the form like changing fonts when the track bars are scrolled, updating the progress bar value using a timer, and showing a link when the progress is complete. Tool tips are also added to describe the controls.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views11 pages

Scroll Bar Functionality in Forms

This document contains code for a Windows form application that uses various controls like track bars, scroll bars, month calendar, progress bar, link label, timer, tool tips, combo box, check box list, and list box. The code handles events for these controls to update other controls on the form like changing fonts when the track bars are scrolled, updating the progress bar value using a timer, and showing a link when the progress is complete. Tool tips are also added to describe the controls.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

TrackBar, Scroll, Tool Tip

MonthCalendar
Form1

Track Bar 1

Track Bar 2

Month Calendar 1
• Private Sub Form1_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
• TrackBar1.Maximum = 40
• TrackBar1.Minimum = 1
• TrackBar1.Value = 12
• TrackBar2.Maximum = _
• FontFamily.Families.Length - 1
• TrackBar2.Minimum = 0
• TrackBar2.Value = 1
• TextBox1.Text = _
• "This is some sample text"
• ' _ is used when ur going to continue in the next line
• TextBox1.Font = New
Font(FontFamily.Families(TrackBar2.Value), TrackBar1.Value)
• End Sub
• Private Sub TrackBar_Scroll(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
TrackBar1.Scroll, TrackBar2.Scroll

• Dim Family As FontFamily =


• FontFamily.Families(TrackBar2.Value)
• If (Family.IsStyleAvailable(FontStyle.Regular)) Then
• Dim F As New Font(Family, TrackBar1.Value)
• TextBox1.Font = F
• Label2.Text = F.SizeInPoints
• Label4.Text = F.Name
• End If
• End Sub
• Private Sub MonthCalendar1_DateChanged(ByVal
sender As System.Object, ByVal e As
System.Windows.Forms.DateRangeEventArgs)
Handles MonthCalendar1.DateChanged
• Dim sdate, edate As Date
• sdate = "25/08/2018"
• edate = Date.Today
• MonthCalendar1.SelectionRange = New
SelectionRange(sdate, edate)
• End Sub
• End Class
Scroll Bars

VScrollBar1
VScrollBar2

HScrollBar1

Text Box1
• Public Class Form2
• Dim r, g, b As Integer
• Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
• Form3.Show()
• Me.Hide()
• End Sub
• Private Sub ScrollBar_Scroll(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll,
VScrollBar1.Scroll, VScrollBar2.Scroll
• r = HScrollBar1.Value
• g = VScrollBar1.Value
• b = VScrollBar2.Value
• PictureBox1.BackColor = Color.FromArgb(r, g, b)
• TextBox1.Text = r & " " & g & " " & b
• End Sub
Progress Bar, Link Label, Timer

Text Box 1
Progress
Bar 1

Link Label 1

Timer 1
set interval property value to 500
• Public Class Form3
• Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
• If Not ProgressBar1.Value >= 100 Then
• ProgressBar1.Value = ProgressBar1.Value + 10
• TextBox1.Text = ProgressBar1.Value
• Else
• LinkLabel1.Visible = True
• TextBox1.Text = "www.google.com"
• End If
• End Sub
• Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
• Form4.Show()
• Me.Hide()
• End Sub
• Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
• System.Diagnostics.Process.Start(LinkLabel1.Text)
• End Sub
• End Class
Tool Tips
• Public Class Form4
• Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
• ListBox1.Items.Add(ComboBox1.SelectedItem)
• ListBox1.Sorted = True
• ToolTip1.SetToolTip(ComboBox1, "COMBO BOX")
• End Sub
• Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
• End
• End Sub
• Private Sub CheckedListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CheckedListBox1.SelectedIndexChanged
• ListBox1.Items.Add(CheckedListBox1.SelectedItem)
• ListBox1.Sorted = True
• ToolTip1.SetToolTip(CheckedListBox1, "Checked LIST")
• End Sub
• Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ListBox1.SelectedIndexChanged
• ToolTip1.SetToolTip(ListBox1, "LIST")
• End Sub

You might also like