Wat is hier mis mee om de binaire waarde te bepalen?
Option Compare Database
Option Explicit
Private Sub test_Click()
Dim Uitkomst, Getal As Integer
Dim iRest As Integer
Dim sConv As String, sBin As String
Getal = 2315
If IsEmpty(Getal) Then Exit Sub
Do While Getal
On Error Resume Next
Uitkomst = Round(Getal / 2, 0)
iRest = Getal - (Uitkomst * 2)
sConv = Choose(iRest + 1, 0, 1)
sBin = sConv & sBin
On Error Resume Next
'leuk om te zien hoe een decimaal naar een binair wordt omgezet...
MsgBox "Getal............... = " & Getal & Chr(13) & _
"Uitkomst........ = " & Uitkomst & " (= round(Getal : 2))" & Chr(13) & _
"Rest................. = " & iRest & " (= Getal - (Uitkomst x 2))" & Chr(13) & _
"Rest in ............ = " & sConv & Chr(13) & _
"Opbouw bin.-waarde. = " & sBin, vbOKOnly, "Voortgang..."
Getal = Uitkomst
Loop
MsgBox "Eindresultaat = " & sConv & sBin, vbOKOnly, "Einde..."
Debug.Print sConv & sBin
End Sub