Visual Basic Average Calculator
Submitted by rinvizle on Thursday, September 15, 2016 - 08:36.
This tutorial we will show you how to create a Average Calculator written in Visual Basic. This application is created to calculate the average of the subjects and display on the screen. The application is very useful for the schools and colleges to calculate results of each students in each subjects. See example code below.
Hope that you learn from this tutorial and don't forget to Like & Share this project and the website. Enjoy Coding...!
Sample Code
This script is for the function for displaying the splash screen and has a interval time to hide.
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Me.Hide()
- Dim frmSplash As New SplashScreen1
- frmSplash.Show()
- frmSplash.Update()
- Threading.Thread.Sleep(3000)
- Me.Visible = True
- End Sub
This script is for the function for the calculation of average by inputting the function together to the button and calling each name of textbox and adding together through the function of addition and division.
- Public Class Form1
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Dim intSubject1 As Integer = TextBox1.Text
- Dim intSubject2 As Integer = TextBox2.Text
- Dim intSubject3 As Integer = TextBox3.Text
- Dim intSubject4 As Integer = TextBox4.Text
- Dim intAnswer As Integer
- Dim intAdd As Integer
- intAdd = (intSubject1 + intSubject2 + intSubject3 + intSubject4) / 4
- intAnswer = intAdd
- Me.lblAnswer.Text = "Your Average Is = " & intAnswer
- End Sub
- Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
- End Sub
- End Class
Add new comment
- 4499 views