Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Problem with Printing to a Text box in a Recursive Program


Reply
 
Thread Tools Display Modes
  #1  
Old 04-19-2006, 02:37 PM
cooliebadbai cooliebadbai is offline
Newcomer
 
Join Date: Dec 2005
Posts: 22
Default Problem with Printing to a Text box in a Recursive Program


I have a recursive program (using VB.net) and i'm using a textbox as the output. The recursive program is supposed to translate an integer into binary code and the problem is that (because it is recursive) the output statement rewrites over any text that was outputted earlier. For example instead of having "101101" show up, just "1" shows up because the output statement (that prints to the textbox) just rewrites over it every time.

Does anyone know how I can solve this? I'm sure it's probably a simple solution, but I do not have adequate training in VB.net yet. (If it was VB 6, I would of used a picturebox and use the print function). Thanks for any help.
Reply With Quote
  #2  
Old 04-19-2006, 03:02 PM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

Without seeing the code?
__________________
~ Quod non mortiferum, fortiorem me facit ~

Avatar by lebb
Reply With Quote
  #3  
Old 04-19-2006, 03:15 PM
surixurient's Avatar
surixurient surixurient is offline
Junior Contributor
 
Join Date: Apr 2005
Location: between C0000h and C7FFFh
Posts: 351
Default

maybe just build a string, and dont output it until its finished being build

strText = strText & "0"

etc.


then when its finished print strText
__________________
I Thunk, therefore I am.
Reply With Quote
  #4  
Old 04-19-2006, 06:55 PM
cooliebadbai cooliebadbai is offline
Newcomer
 
Join Date: Dec 2005
Posts: 22
Default

Quote:
Originally Posted by surixurient
maybe just build a string, and dont output it until its finished being build

strText = strText & "0"

etc.


then when its finished print strText
yes, that should work...thanks for the help. I knew it was something simple.
Reply With Quote
  #5  
Old 04-20-2006, 02:46 AM
jo0ls jo0ls is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Feb 2005
Location: London
Posts: 1,050
Default

Convert.ToString does binary:

Code:
Dim theNumber As Integer = 146 Dim theNumberInBinary As String = Convert.ToString(theNumber, 2) Dim theNumberInOctal As String = Convert.ToString(theNumber, 8) Dim theNumberInBase16 As String = Convert.ToString(theNumber, 16) Dim s As String = String.Format( _ "The number {0} is {1} in binary, {2} in Octal, and {3} in Hex", _ theNumber, theNumberInBinary, theNumberInOctal, theNumberInBase16) Debug.WriteLine(s)
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->