0% found this document useful (0 votes)
24 views

Public Class Private Sub Byval As Byval As Handles Mybase: Form1 Object Eventargs

This document contains the code for a Windows form application that calculates statistics for a set of numbers. The form contains labels and text boxes to display input, output, and statistics. It checks for empty input and calculates the sum, average, maximum, and minimum of numbers from 1 to the input value. The numbers and results are displayed in list and text boxes.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Public Class Private Sub Byval As Byval As Handles Mybase: Form1 Object Eventargs

This document contains the code for a Windows form application that calculates statistics for a set of numbers. The form contains labels and text boxes to display input, output, and statistics. It checks for empty input and calculates the sum, average, maximum, and minimum of numbers from 1 to the input value. The numbers and results are displayed in list and text boxes.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
Label1.Text = "Jumlah Bilangan"
Button1.Text = "Proses"
Label2.Text = "Daftar Bilangan"
Label3.Text = "Jumlah"
Label4.Text = "Rata-rata"
Label5.Text = "Terbesar"
Label6.Text = "Terkecil"
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
If TextBox1.Text = "" Then
MessageBox.Show("Tidak boleh kosong", "Peringatan", MessageBoxButtons.OK,
MessageBoxIcon.Information)
End If

Dim rerata As Integer


Dim sum As Integer
Dim i As Integer
Dim x As Integer

ListBox1.Items.Clear()
x = Val(TextBox1.Text)
sum = 0
For i = 1 To x
ListBox1.Items.Add(i)
sum = sum + i
Next

rerata = sum / x

TextBox4.Text = x
TextBox5.Text = 1
TextBox2.Text = sum
TextBox3.Text = rerata

End Sub
End Class

You might also like