HN-Community
Aplikasi segitiga pascal dengan VB.NET - Printable Version

+- HN-Community (https://hacker-newbie.org)
+-- Forum: Miscellaneous (https://hacker-newbie.org/forum-86.html)
+--- Forum: Coding/Programing (https://hacker-newbie.org/forum-19.html)
+---- Forum: Visual Basic (VB) (https://hacker-newbie.org/forum-68.html)
+---- Thread: Aplikasi segitiga pascal dengan VB.NET (/thread-9894.html)



Aplikasi segitiga pascal dengan VB.NET - RieqyNS13 - 08-29-2011

komponen :

2 Button
1 TextBox ,dgn Property Multiline bernilai True, atur juga agar property font menjadi Courier New
1 Label dengan property text: Tinggi Piramida
Numericupdown dengan property minimum: 2


Hmmm..setau ane Courier New dipilih agar tampilan piramida nantinya tidak miring sebelah gan . Font Courier New memiliki sifat yang unik gan, yaitu lebar setiap jenih huruf sama, sehingga nantinya akan tampil piramida dengan bentuk yang seimbang. wwkkw

Susun komponen diatas seperti gambar berikut :
[Image: pascal.bmp]

Sekarang double klik button dengan property text Tampilkan, lalu masukkan kode berikut:

Code:
Dim x, y, z As Integer x = 1 : y = NumericUpDown1.Value TextBox1.Clear() Do While x <= y z = 1 TextBox1.Text = _ TextBox1.Text & Space(y - x) Do While z <= x TextBox1.Text = _ TextBox1.Text & " " & z z += 1 Loop TextBox1.Text = _ TextBox1.Text & vbCrLf x += 1 Loop



Berikutnya, double klik button dengan property text Keluar, lalu ketikkan kode berikut:

Code:
End
SantetTakut