Artikel ini akan membahas tentang Contoh Sederhana Penggunaan Do While, Do Until, For, dan While EndWhile pada VB Net 2008
Desain form :
Berikut Source Codenya :
Desain form :
Berikut Source Codenya :
Public Class Form1
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim x As Byte
x = 1
Do While x <= 10
ListBox1.Items.Add(x)
x = x + 1
Loop
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim x As Byte
x = 1
Do Until x = 11
ListBox2.Items.Add(x)
x = x + 1
Loop
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim x As Byte
For x =
1 To 10
ListBox3.Items.Add(x)
Next
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim x As Byte
x = 1
While x
<= 10
ListBox4.Items.Add(x)
x = x + 1
End While
End Sub
End Class
jika dijalankan, maka hasilnya akan seperti berikut :
jika dijalankan, maka hasilnya akan seperti berikut :
Sekian artikel kali ini tentang VB Net 2008, Semoga bermanfaat..!! :)
terimakasih banyak sobat
BalasHapus