Anda di halaman 1dari 3

APLIKASI KONVERSI BINER - DESIMAL

Oleh:

[ NAMA / NRP ]

[KELOMPOK]

JURUSAN TEKNIK INFORMATIKA


FAKULTAS TEKNIK
UNIVERSITAS TRUNOJOYO
2009 2010

APLIKASI KONVERSI DESIMAL - BINER

Berikut ini adalah penjelasan coding dari program decimal biner converter buatan saya
dengan menggunakan Visual Basic 2008 Express Edition
No
1

Komponen
Form

Label

Textbox1

Textbox2

Button1

Button2

Button3

Properties

Nilai

Name

Form1

Text

Aplikasi Konversi Desimal Biner

Text

Konversi Desimal dan Biner

Text

Nilai

Name

Nilai

Text

Name

Hasil

Text

Name

Btnkonversi

Text

&Konversi

Name

Btnreset

Text

&Reset

Name

Btnexit

Text

&Exit

Public Class Form1


Dim n, pem, sisa, has As Long
Dim bin As String
Dim response As MsgBoxResult
Private Sub btnkonversi_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnkonversi.Click
If rbdec2bin.Checked Then
n = nilai.Text
While n > pem
has = n \ 2
sisa = n Mod 2
bin = Str(sisa) & bin
n = has
End While
hasil.Text = bin
bin = ""
Else
hasil.Text = 0
For g As Integer = Len(nilai.Text) To 1 Step -1
hasil.Text = hasil.Text + Mid(nilai.Text, g, 1) * (2 ^
(Len(nilai.Text) - g))
Next g
End If
End Sub
---------------------------------------------------------------Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnexit.Click
response = MsgBox("Apakah Anda yakin ingin keluar",
MsgBoxStyle.OkCancel, "Konfirmasi Keluar")
If response = MsgBoxResult.Ok Then
End
End If
End Sub
-----------------------------------------------------------------Private Sub btnreset_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnreset.Click
nilai.Text = ""
hasil.Text = ""
End Sub
End Class