
Bagi temen-temen yang mungkin butuh source cobe VB untuk membuat program konversi dari bilangan biner ke bilangan octal. Aligede punya sedikit koleksi yang mungkin berguna untuk temen-temen yang butuh, berikut source code nya:
Private Function BinaryToDecimal(ByVal BinValue As String) As Long
Dim lngValue As Long
Dim x As Long
Dim k As Long
k = Len(BinValue) 'will only work with 30 or fewer "bits"
For x = k To 1 Step -1 'work backwards down string
If Mid$(BinValue, x, 1) = "1" Then
If k - x > 30 Then
lngValue = lngValue Or -2147483648# 'avoid overflow error
Else
lngValue = lngValue + 2 ^ (k - x)
End If
End If
Next x
BinaryToDecimal = lngValue
End Function
Private Sub Command1_Click()
bil1 = BinaryToDecimal(Text1)
Text2.Text = Oct(bil1)
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Text1.Text = "0"
Text2.Text = "0"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not (KeyAscii = 48 Or KeyAscii = 49 Or KeyAscii = 8 Or KeyAscii = 46) Then
KeyAscii = 0
End If
End Sub
0Awesome Comments!