Anda di halaman 1dari 4

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

Anda mungkin juga menyukai