This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured post 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Minggu, 28 Oktober 2012

Tugas Pemrogaman VB



  1. Saat form dijalankan : semua isian tidak aktif, tombol isi data dan tutup aktif, tombol clear
   tidak aktif.



2. Saat ditekan tombol isi data : kode barang jumlah barang, cara beli tombol clear aktif,
   tombol isi data tidak aktif.
3. Saat ditekan tombol clear maka akan sama dengan saat form dijalankan pertama kali.



Program Puzlee 
Source Code nya :

Public Class Form1Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim control As Windows.Forms.Control
For Each control In Me.Controls
If control.GetType.Name = “Button” Then
Dim rndnumber As Random
Dim number As Integer
rndnumber = New Random
number = rndnumber.Next(1, 9)
control.Text = numberIf Button2.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button2.Text = number
Loop Until Button2.Text <> Button1.Text
End If If Button3.Text = Button2.Text Or Button3.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button3.Text = number
Loop Until Button3.Text <> Button2.Text And Button3.Text <> Button1.Text
End If
If Button4.Text = Button3.Text Or Button4.Text = Button2.Text Or Button4.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button4.Text = number
Loop Until Button4.Text <> Button3.Text And Button4.Text <> Button2.Text And Button4.Text <> Button1.Text
End If
If Button4.Text = Button3.Text Or Button4.Text = Button2.Text Or Button4.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button4.Text = number
Loop Until Button4.Text <> Button3.Text And Button4.Text <> Button2.Text And Button4.Text <> Button1.Text
End If
If Button5.Text = Button4.Text Or Button5.Text = Button3.Text Or Button5.Text = Button2.Text Or Button5.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button5.Text = number
Loop Until Button5.Text <> Button4.Text And Button5.Text <> Button3.Text And Button5.Text <> Button2.Text And Button5.Text <> Button1.Text
End If
If Button6.Text = Button5.Text Or Button6.Text = Button4.Text Or Button6.Text = Button3.Text Or Button6.Text = Button2.Text Or Button6.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button6.Text = number
Loop Until Button6.Text <> Button5.Text And Button6.Text <> Button3.Text And Button6.Text <> Button2.Text And Button6.Text <> Button1.Text
End If
If Button7.Text = Button6.Text Or Button7.Text = Button5.Text Or Button7.Text = Button4.Text Or Button7.Text = Button3.Text Or Button7.Text = Button2.Text Or Button7.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button7.Text = number
Loop Until Button7.Text <> Button6.Text And Button7.Text <> Button5.Text And Button7.Text <> Button4.Text And Button7.Text <> Button3.Text And Button7.Text <> Button2.Text And Button7.Text <> Button1.Text
End If
If Button8.Text = Button7.Text Or Button8.Text = Button6.Text Or Button8.Text = Button5.Text Or Button8.Text = Button4.Text Or Button8.Text = Button3.Text Or Button8.Text = Button2.Text Or Button8.Text = Button1.Text Then
Do
number = rndnumber.Next(1, 9)
Button8.Text = number
Loop Until Button8.Text <> Button7.Text And Button8.Text <> Button6.Text And Button8.Text <> Button5.Text And Button8.Text <> Button4.Text And Button8.Text <> Button3.Text And Button8.Text <> Button2.Text And Button8.Text <> Button1.Text
End If
End If
Button9.Text = “”
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button2.Text = “” Then
Button2.Text = Button1.Text
Button1.Text = “”
ElseIf Button4.Text = “” Then
Button4.Text = Button1.Text
Button1.Text = “”
End If
If Button1.Text = “1″ And Button2.Text = “2″ And Button3.Text = “3″ And Button4.Text = “4″ And Button5.Text = “5″ And Button6.Text = “6″ And Button7.Text = “7″ And Button8.Text = “8″ And Button9.Text = “” Then
MsgBox(“Selamat Anda Menang”)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button1.Text = “” Then
Button1.Text = Button2.Text
Button2.Text = “”
ElseIf Button3.Text = “” Then
Button3.Text = Button2.Text
Button2.Text = “”
ElseIf Button5.Text = “” Then
Button5.Text = Button2.Text
Button2.Text = “”
End If
If Button1.Text = “1″ And Button2.Text = “2″ And Button3.Text = “3″ And Button4.Text = “4″ And Button5.Text = “5″ And Button6.Text = “6″ And Button7.Text = “7″ And Button8.Text = “8″ And Button9.Text = “” Then
MsgBox(“Selamat Anda Menang”)
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Button2.Text = “” Then
Button2.Text = Button3.Text
Button3.Text = “”
ElseIf Button6.Text = “” Then
Button6.Text = Button3.Text
Button3.Text = “”
End If
If Button1.Text = “1″ And Button2.Text = “2″ And Button3.Text = “3″ And Button4.Text = “4″ And Button5.Text = “5″ And Button6.Text = “6″ And Button7.Text = “7″ And Button8.Text = “8″ And Button9.Text = “” Then
MsgBox(“Selamat Anda Menang”)
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If Button1.Text = “” Then
Button1.Text = Button4.Text
Button4.Text = “”
ElseIf Button7.Text = “” Then
Button7.Text = Button4.Text
Button4.Text = “”
ElseIf Button5.Text = “” Then
Button5.Text = Button4.Text
Button4.Text = “”
End If
If Button1.Text = “1″ And Button2.Text = “2″ And Button3.Text = “3″ And Button4.Text = “4″ And Button5.Text = “5″ And Button6.Text = “6″ And Button7.Text = “7″ And Button8.Text = “8″ And Button9.Text = “” Then
MsgBox(“Selamat Anda Menang”)
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If Button2.Text = “” Then
Button2.Text = Button5.Text
Button5.Text = “”
ElseIf Button4.Text = “” Then
Button4.Text = Button5.Text
Button5.Text = “”
ElseIf Button6.Text = “” Then
Button6.Text = Button5.Text
Button5.Text = “”
ElseIf Button8.Text = “” Then
Button8.Text = Button5.Text
Button5.Text = “”
End If
If Button1.Text = “1″ And Button2.Text = “2″ And Button3.Text = “3″ And Button4.Text = “4″ And Button5.Text = “5″ And Button6.Text = “6″ And Button7.Text = “7″ And Button8.Text = “8″ And Button9.Text = “” Then
MsgBox(“Selamat Anda Menang”)
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If Button9.Text = “” Then
Button9.Text = Button6.Text
Button6.Text = “”
ElseIf Button3.Text = “” Then
Button3.Text = Button6.Text
Button6.Text = “”
ElseIf Button5.Text = “” Then
Button5.Text = Button6.Text
Button6.Text = “”
End If
If Button1.Text = “1″ And Button2.Text = “2″ And Button3.Text = “3″ And Button4.Text = “4″ And Button5.Text = “5″ And Button6.Text = “6″ And Button7.Text = “7″ And Button8.Text = “8″ And Button9.Text = “” Then
MsgBox(“Selamat Anda Menang”)
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If Button4.Text = “” Then
Button4.Text = Button7.Text
Button7.Text = “”
ElseIf Button8.Text = “” Then
Button8.Text = Button7.Text
Button7.Text = “”
End If
If Button1.Text = “1″ And Button2.Text = “2″ And Button3.Text = “3″ And Button4.Text = “4″ And Button5.Text = “5″ And Button6.Text = “6″ And Button7.Text = “7″ And Button8.Text = “8″ And Button9.Text = “” Then
MsgBox(“Selamat Anda Menang”)
End If
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If Button7.Text = “” Then
Button7.Text = Button8.Text
Button8.Text = “”
ElseIf Button9.Text = “” Then
Button9.Text = Button8.Text
Button8.Text = “”
ElseIf Button5.Text = “” Then
Button5.Text = Button8.Text
Button8.Text = “”
End If
If Button1.Text = “1″ And Button2.Text = “2″ And Button3.Text = “3″ And Button4.Text = “4″ And Button5.Text = “5″ And Button6.Text = “6″ And Button7.Text = “7″ And Button8.Text = “8″ And Button9.Text = “” Then
MsgBox(“Selamat Anda Menang”)
End If
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If Button6.Text = “” Then
Button6.Text = Button9.Text
Button9.Text = “”
ElseIf Button8.Text = “” Then
Button8.Text = Button9.Text
Button9.Text = “”
End If
If Button1.Text = “1″ And Button2.Text = “2″ And Button3.Text = “3″ And Button4.Text = “4″ And Button5.Text = “5″ And Button6.Text = “6″ And Button7.Text = “7″ And Button8.Text = “8″ And Button9.Text = “” Then
MsgBox(“Selamat Anda Menang”)
End If
End Sub
End Class

TAMPILAN SETELAH BERHASIL



 

Minggu, 21 Oktober 2012

Analis Program Visual Basic

Jawaban Latihan 1 NO.3


a.  Penyebabkan error pada btalamat1_Click adalah :
Kita seharusnya mendeklarasikan variabel “alamat” dengan DIM dan type data STRING
        Dim alamat As String
        alamat = "kuningan"
        txtalamat.Text = alamat

b.         Karena Pada tombol nama1 pendeklarasian nama sudah di masukan Dim nama As String
Nama = “Nandang” dan pada tombol nama2, nama belum di deklarasikan sehingga sehingga mengambil dari module
Pada Btalamat 1 dan tombol alamat
2 sudah di deklarasikan di form
1 dengan Conts alamat = “kuningan”
 

c. Analisa saya untuk Form Dua, saat kita melihat coding pada FrmDua kita melihat ada baris perintah :
Option Explicit Off
Itu artinya bahwa variabel pada FrmDua tidak perlu kita definisikan dan program akan langsung mengambil definisi variabel-variabel itu dari variabel Public yang terdapat dimanapun. Pada program ini variabel-variable tersebtu terdapat pada Module1. Sehingga pada saat kita menekan tombol Nama atau Alamat atau Umur, nilai yang keluar adalah nilai yang terdapat pada Module1.
 
 
 
Latihan 2
 
Kelemahan
 
Kelemahan dari program ke dua yaitu tidak ada deklerasian dari “TAS”, sehingga jika kita ingin memunculkan harga tas tidak bisa. Cara memperbaikinya dengan mendambahkan variabel Tas.
Contoh program : Case “TAS”
namabarang = “TAS”
harga =200000
 
Case Else
                namabarang = "TAS"
                harga = 200000




selamat mencoba

 

Minggu, 14 Oktober 2012

MEMBUAT APLIKASI SUHU DENGAN VISUAL BASIC

  • Pada Button1(Kelvin)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x, z As Double
x = Val(TextBox1.Text)
z = x + 273
TextBox2.Text = z
End Sub
  • Pada Button2(Farenheit)
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim x, z As Double
x = Val(TextBox1.Text)
z = (x * 1.8) + 32
TextBox2.Text = z
End Sub
  • Pada Button3(Reamur)
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim x, z As Double
x = Val(TextBox1.Text)
z = 5 / 4 * x
TextBox2.Text = z
End Sub
  • Pada Button4(Hapus)
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More