Heb net 25 paginas met oude topics doorgezocht, maar nergens stond mijn probleempje, dus alsnog:
Ik ben nog n00b en ik moet een programmatje schrijven dat een geheel decimaal getal van maximaal 65000 in waarde omzet naar een binair getal.
Hier de source:
Dim lngDecimaal As Long
Dim bytBit1 As Byte
Dim bytBit2 As Byte
Dim bytBit4 As Byte
Dim bytBit8 As Byte
Dim bytBit16 As Byte
Dim bytBit32 As Byte
Dim bytBit64 As Byte
Dim bytBit128 As Byte
Dim bytBit256 As Byte
Dim bytBit512 As Byte
Dim bytBit1024 As Byte
Dim bytBit2048 As Byte
Private Sub cmdBereken_Click()
lngDecimaal = Val("txtDecimaal.text")
bytBit1 = (lngDecimaal \ 1)
bytBit2 = (lngDecimaal \ 2)
bytBit4 = (lngDecimaal \ 4)
bytBit8 = (lngDecimaal \
bytBit16 = (lngDecimaal \ 16)
bytBit32 = (lngDecimaal \ 32)
bytBit64 = (lngDecimaal \ 64)
bytBit128 = (lngDecimaal \ 128)
bytBit256 = (lngDecimaal \ 256)
bytBit512 = (lngDecimaal \ 512)
bytBit1024 = (lngDecimaal \ 1024)
bytBit2048 = (lngDecimaal \ 2048)
txtBit1.Text = (lngDecimaal - 1 * bytBit1)
txtBit2.Text = (lngDecimaal - 2 * bytBit2)
txtBit4.Text = (lngDecimaal - 4 * bytBit4)
txtBit8.Text = (lngDecimaal - 8 * bytBit8)
txtBit16.Text = (lngDecimaal - 16 * bytBit16)
txtBit32.Text = (lngDecimaal - 32 * bytBit32)
txtBit64.Text = (lngDecimaal - 64 * bytBit64)
txtBit128.Text = (lngDecimaal - 128 * bytBit128)
txtBit256.Text = (lngDecimaal - 256 * bytBit256)
txtBit512.Text = (lngDecimaal - 512 * bytBit512)
txtBit1024.Text = (lngDecimaal - 1024 * bytBit1024)
txtBit2048.Text = (lngDecimaal - 2048 * bytBit2048)
End Sub
Kan iemand me hierbij helpen? Moet ik maandag voor sk00l afhebben en ben er al een paar dagen mee bezig.
Het eigenlijke probleem is dat de textboxen die de binaire uitkomst moeten leveren 0 blijven.
Anyone plz?
Het 2e probleem:
Ik mag geen do-while of if-then etc. statements gebruiken, extra uitdaging vanuit school
Ik ben nog n00b en ik moet een programmatje schrijven dat een geheel decimaal getal van maximaal 65000 in waarde omzet naar een binair getal.
Hier de source:
Dim lngDecimaal As Long
Dim bytBit1 As Byte
Dim bytBit2 As Byte
Dim bytBit4 As Byte
Dim bytBit8 As Byte
Dim bytBit16 As Byte
Dim bytBit32 As Byte
Dim bytBit64 As Byte
Dim bytBit128 As Byte
Dim bytBit256 As Byte
Dim bytBit512 As Byte
Dim bytBit1024 As Byte
Dim bytBit2048 As Byte
Private Sub cmdBereken_Click()
lngDecimaal = Val("txtDecimaal.text")
bytBit1 = (lngDecimaal \ 1)
bytBit2 = (lngDecimaal \ 2)
bytBit4 = (lngDecimaal \ 4)
bytBit8 = (lngDecimaal \
bytBit16 = (lngDecimaal \ 16)
bytBit32 = (lngDecimaal \ 32)
bytBit64 = (lngDecimaal \ 64)
bytBit128 = (lngDecimaal \ 128)
bytBit256 = (lngDecimaal \ 256)
bytBit512 = (lngDecimaal \ 512)
bytBit1024 = (lngDecimaal \ 1024)
bytBit2048 = (lngDecimaal \ 2048)
txtBit1.Text = (lngDecimaal - 1 * bytBit1)
txtBit2.Text = (lngDecimaal - 2 * bytBit2)
txtBit4.Text = (lngDecimaal - 4 * bytBit4)
txtBit8.Text = (lngDecimaal - 8 * bytBit8)
txtBit16.Text = (lngDecimaal - 16 * bytBit16)
txtBit32.Text = (lngDecimaal - 32 * bytBit32)
txtBit64.Text = (lngDecimaal - 64 * bytBit64)
txtBit128.Text = (lngDecimaal - 128 * bytBit128)
txtBit256.Text = (lngDecimaal - 256 * bytBit256)
txtBit512.Text = (lngDecimaal - 512 * bytBit512)
txtBit1024.Text = (lngDecimaal - 1024 * bytBit1024)
txtBit2048.Text = (lngDecimaal - 2048 * bytBit2048)
End Sub
Kan iemand me hierbij helpen? Moet ik maandag voor sk00l afhebben en ben er al een paar dagen mee bezig.
Het eigenlijke probleem is dat de textboxen die de binaire uitkomst moeten leveren 0 blijven.
Anyone plz?
Het 2e probleem:
Ik mag geen do-while of if-then etc. statements gebruiken, extra uitdaging vanuit school