100% found this document useful (1 vote)
67 views5 pages

Latihan PBO 1

The document contains 3 Visual Basic .NET programs: 1. A program to calculate the area of a rectangle by multiplying its length and width. 2. Two programs that demonstrate inputting and displaying text, and changing text attributes like color, bold, etc. 3. A program that calculates a student's subject grade based on test, exam, assignment, and attendance scores and displays the grade and corresponding letter grade.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
67 views5 pages

Latihan PBO 1

The document contains 3 Visual Basic .NET programs: 1. A program to calculate the area of a rectangle by multiplying its length and width. 2. Two programs that demonstrate inputting and displaying text, and changing text attributes like color, bold, etc. 3. A program that calculates a student's subject grade based on test, exam, assignment, and attendance scores and displays the grade and corresponding letter grade.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

prjLUAS

1. PROGRAM MENGHITUNG LUAS


Public Class Form1

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


Handles btnhitung.Click
lblhasil.Text = Val(txtpanjang.Text) * Val(txtlebar.Text)
End Sub
End Class

prjTEXT
1. PROGRAM MASUKKAN TEXT

Public Class Form1

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


Handles Button1.Click
Label2.Text = TextBox1.Text
End Sub
End Class
2. PROGRAM TEXT SEDERHANA

Public Class Form2


Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
TextBox1.Text = ""
Label3.Text = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Label3.Text = TextBox1.Text
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton1.CheckedChanged
Label3.ForeColor = Color.Red
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton2.CheckedChanged
Label3.ForeColor = Color.Yellow
End Sub
Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton3.CheckedChanged
Label3.ForeColor = Color.Green
End Sub
Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton4.CheckedChanged
Label3.ForeColor = Color.Blue
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox1.CheckedChanged
If Me.CheckBox1.Checked = True Then
Label3.Font = New Font(Label3.Font, Label3.Font.Style Or FontStyle.Bold)
Else
Label3.Font = New Font(Label3.Font, Label3.Font.Style And Not FontStyle.Bold)
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox2.CheckedChanged
If Me.CheckBox2.Checked = True Then
Label3.Font = New Font(Label3.Font, Label3.Font.Style Or FontStyle.Italic)
Else
Label3.Font = New Font(Label3.Font, Label3.Font.Style And Not FontStyle.Italic)
End If
End Sub

Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles CheckBox3.CheckedChanged
If Me.CheckBox3.Checked = True Then
Label3.Font = New Font(Label3.Font, Label3.Font.Style Or FontStyle.Underline)
Else
Label3.Font = New Font(Label3.Font, Label3.Font.Style And Not FontStyle.Underline)
End If
End Sub

Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles CheckBox4.CheckedChanged
If Me.CheckBox4.Checked = True Then
Label3.Font = New Font(Label3.Font, Label3.Font.Style Or FontStyle.Strikeout)
Else
Label3.Font = New Font(Label3.Font, Label3.Font.Style And Not FontStyle.Strikeout)
End If
End Sub
End Class

3. PROGRAM NILAI MATA PELAJARAN


Public Class Form3
Public uts As Integer
Public uas As Integer
Public ulangan As Integer
Public tugas As Integer
Public kehadiran As Integer
Public total As Integer
Public predikat As String

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


Handles btnkeluar.Click
Dispose()
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
txtnama.Text = ""
txtmapel.Text = ""
txtuts.Text = ""
txtuas.Text = ""
txtulangan.Text = ""
txttugas.Text = ""
txthadir.Text = ""
txtnilai.Text = ""
txtpredikat.Text = ""
txtnilai.Enabled = False
txtpredikat.Enabled = False
txtnama.Focus()
End Sub
Private Sub txtnama_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtnama.KeyPress
If (e.KeyChar = Chr(13)) Then
txtmapel.Focus()
End If
End Sub
Private Sub txtmapel_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtmapel.KeyPress
If (e.KeyChar = Chr(13)) Then
txtuts.Focus()
End If
End Sub
Private Sub txtuts_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtuts.KeyPress
If (e.KeyChar = Chr(13)) Then
txtuas.Focus()
End If
End Sub
Private Sub txtuas_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtuas.KeyPress
If (e.KeyChar = Chr(13)) Then
txtulangan.Focus()
End If
End Sub
Private Sub txtulangan_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtulangan.KeyPress
If (e.KeyChar = Chr(13)) Then
txttugas.Focus()
End If
End Sub
Private Sub txttugas_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txttugas.KeyPress
If (e.KeyChar = Chr(13)) Then
txthadir.Focus()
End If
End Sub
Private Sub txthadir_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txthadir.KeyPress
If (e.KeyChar = Chr(13)) Then
btnproses.Focus()
End If
End Sub
Private Sub btnproses_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
btnproses.Click
txtnilai.Text = (Val(txtuts.Text * 0.25) + Val(txtuas.Text * 0.3) + Val(txtulangan.Text
* 0.1) + Val(txttugas.Text * 0.1) + Val(txthadir.Text * 0.25))
If Val(txtnilai.Text) >= 85 Then
txtpredikat.Text = "A"
ElseIf Val(txtnilai.Text) >= 75 Then
txtpredikat.Text = "B"
ElseIf Val(txtnilai.Text) >= 65 Then
txtpredikat.Text = "C"
ElseIf Val(txtnilai.Text) >= 55 Then
txtpredikat.Text = "D"
ElseIf Val(txtnilai.Text) < 55 Then
txtpredikat.Text = "E"
End If
End Sub
End Class

You might also like