0% found this document useful (0 votes)
48 views6 pages

Pertemuan 7 Ardi Nurdiansyah 19402004

The document discusses creating a looping program in Visual Basic .NET. It provides steps for setting up a new project, designing the user interface, and adding code to implement different loop structures like For, While, and Do loops.

Uploaded by

Ardi Nurdiansyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views6 pages

Pertemuan 7 Ardi Nurdiansyah 19402004

The document discusses creating a looping program in Visual Basic .NET. It provides steps for setting up a new project, designing the user interface, and adding code to implement different loop structures like For, While, and Do loops.

Uploaded by

Ardi Nurdiansyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Nama : Ardi Nurdiansyah

Kelas : SI-XW41/19
NPM : 19402004

Pertemuan 7 Pemograman Visual II


Program Looping

1. Buka aplikasi Visual Studio/ VB.NET

2. Klik new project untuk membuat project baru pada Visual Studio

3. Setelah itu muncul pop untuk membuat new project vb.net


4. Selanjutnya muncul tampilan untuk design

5. Selanjutnya buat program dengan design sesuai keingin kita

6.Setelah design telah dibuat selanjutnya membuat code pada design


atau program yang telah dibuat
7.Double klik from lalu masukan syntax

Public Class Form1

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


Handles MyBase.Load
End Sub

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


Handles Button1.Click
Dim nilaiawal As Integer
Dim nilaiakhir As Integer

nilaiawal = TextBox1.Text
nilaiakhir = TextBox2.Text
For x = nilaiawal To nilaiakhir
ListBox1.Items.Add(x)
Next x
End Sub

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


Handles Button2.Click
Dim nilaiawal As Integer
Dim nilaiakhir As Integer
Dim x As Integer

nilaiawal = TextBox1.Text
nilaiakhir = TextBox2.Text
x = nilaiawal
While (x <= nilaiakhir)
x += 1
End While
End Sub

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


Handles Button3.Click
Dim nilaiawal As Integer
Dim nilaiakhir As Integer
Dim x As Integer

nilaiawal = TextBox1.Text
nilaiakhir = TextBox2.Text
x = nilaiawal
Do Until x > nilaiakhir
ListBox1.Items.Add(x)
x += 1
Loop
End Sub

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


Handles Button4.Click
TextBox1.Text = ""
TextBox1.Text = ""
ListBox1.Text = ""
End Sub

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


Handles Button5.Click
Close()
End Sub
End Class
8.Setelah selesai masukan lanjut klik star atau play di menu bagian
atas layar

9.Berikut hasil dari program yang telah dibuat


Public Class Form1

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


System.EventArgs) Handles GroupBox2.Enter

End Sub

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


Handles BtnNew.Click
TxtLM.Text = "0"
TxtBSK.Text = "0"
TxtHSP.Text = "0"
TxtJB.Text = "0"
TxtK.Text = "0"
End Sub

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


Handles BtnClose.Click
Me.Close()
End Sub

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


System.EventArgs) Handles GroupBox1.Enter

End Sub

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


System.EventArgs) Handles TxtLM.TextChanged
If IsNumeric(TxtLM.Text) Then
TxtBSK.Text = TxtLM.Text * TxtHSP.Text
TxtK.Text = TxtJB.Text - TxtBSK.Text
End If
End Sub

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


System.EventArgs) Handles TxtHSP.TextChanged
If IsNumeric(TxtHSP.Text) Then
TxtBSK.Text = TxtLM.Text * TxtHSP.Text
TxtK.Text = TxtJB.Text - TxtBSK.Text
Else
TxtHSP.Text = 0
MsgBox("Mohon inputkan dengan angka!!)
TxtBSK.Text = TxtLM.Text * TxtHSP.Text
TxtK.Text = TxtJB.Text - TxtBSK.Text
End If
End Sub

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


System.EventArgs) Handles TxtJB.TextChanged
If IsNumeric(TxtJB.Text) Then
TxtBSK.Text = TxtLM.Text * TxtHSP.Text
TxtK.Text = TxtJB.Text - TxtBSK
End If
End Sub
End Class

You might also like