We will end with a program that uses both procedures and functions.
Start a new application and name it Tips. Build the program as shown below:

The maximum on the scroll bar is 10000 so that we can select and dollar amount from 0.00 to 100.00.
All the names of the controls can be determined from the code.
Write the code as shown below:
Public Class Form1
'Programmer: Janet Joy
'Calculate tip
Dim cost As Double
Dim tipPercent As Integer
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'set tags for radio buttons: tags can be used for any purpose
RadBad.Tag = 10
RadGood.Tag = 15
RadExcellent.Tag = 20
tipPercent = 15 'because good is selected
End Sub
Private Sub HSBMealCost_Scroll(sender As Object, e As ScrollEventArgs) Handles HSBMealCost.Scroll
cost = HSBMealCost.Value / 100
LblCost.Text = Format(cost, "$0.00") 'format numbers to 2 decimal places
showTip()
End Sub
Private Sub RadGood_CheckedChanged(sender As Object, e As EventArgs) Handles RadGood.CheckedChanged, RadBad.CheckedChanged, RadExcellent.CheckedChanged
'Get the tiprate from the check button
tipPercent = sender.tag
showTip()
End Sub