| | |
Decimal to Binary Converer
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 5
Reputation:
Solved Threads: 0
Hi everyone , i am trying to fully uderstand the recursion method in vb but i still have problems in making the programs work, Can anyone help me to create a program that convert decimal numbers to binary numbers or point me to the right direction,I know that this can be done by continuing dividing by 2 until the is no more result left but in a recursive method i have problems. Thank you
•
•
Join Date: Apr 2008
Posts: 5
Reputation:
Solved Threads: 0
Hi i found this code on the web that works but can someone tell my how does this works
Private Function RecursionFunc(ByRef AsciiNum As Short, ByRef SubNum As Short) As Object
If AsciiNum - SubNum > 0 Then
txtNew.Text = txtNew.Text & 1 'Add a 1 to indicate that it contains a subnum in it
If SubNum <> 1 Then 'Check to make sure it's not 1
RecursionFunc(AsciiNum - SubNum, SubNum / 2) 'Call myself with the new asciinum and subnum
End If
Else
txtNew.Text = txtNew.Text & 0 'Add a zero to indicate that the subnum is not contained
If SubNum <> 1 Then 'Check to make sure it's not 1
'Call myself with the same asciinum because it does not contain a subnum and make subnum the next smallest
RecursionFunc(AsciiNum, SubNum / 2)
End If
End If
Private Function RecursionFunc(ByRef AsciiNum As Short, ByRef SubNum As Short) As Object
If AsciiNum - SubNum > 0 Then
txtNew.Text = txtNew.Text & 1 'Add a 1 to indicate that it contains a subnum in it
If SubNum <> 1 Then 'Check to make sure it's not 1
RecursionFunc(AsciiNum - SubNum, SubNum / 2) 'Call myself with the new asciinum and subnum
End If
Else
txtNew.Text = txtNew.Text & 0 'Add a zero to indicate that the subnum is not contained
If SubNum <> 1 Then 'Check to make sure it's not 1
'Call myself with the same asciinum because it does not contain a subnum and make subnum the next smallest
RecursionFunc(AsciiNum, SubNum / 2)
End If
End If
•
•
•
•
Hi i found this code on the web that works but can someone tell my how does this works
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: check box in datagrid view
- Next Thread: click and drag to re-order listbox items
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code combobox component convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output passingparameters peertopeervideostreaming picturebox picturebox1 port print printing problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer toolbox trim update updown user validation vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf






