PC Review


Reply
Thread Tools Rate Thread

Binary or hex numbers in textboxes?

 
 
Ole
Guest
Posts: n/a
 
      28th Aug 2006
Hi,

I'm having 2 textboxes in which I enter binary numbers that must be
calculated to a third number that is shown in a third textbox. How do i
convert my entered binary number to an e.g an int and how do I convert the
calculated number to a binary string?

If it's not possible straight away then hex could be the second resolution.
I know how to convert a number to a hex string ToStrin("X"); but not the
opposite way.

Any help is highly appriciated.

Thanks,
Ole


 
Reply With Quote
 
 
 
 
Mark Jerde
Guest
Posts: n/a
 
      28th Aug 2006
There are several samples at codeproject. A few:

http://www.codeproject.com/csharp/hexencoding.asp
http://www.codeproject.com/csharp/hexconverter.asp
http://www.codeproject.com/string/hexstrtoint.asp

HTH.

-- Mark

Ole wrote:
> Hi,
>
> I'm having 2 textboxes in which I enter binary numbers that must be
> calculated to a third number that is shown in a third textbox. How do
> i convert my entered binary number to an e.g an int and how do I
> convert the calculated number to a binary string?
>
> If it's not possible straight away then hex could be the second
> resolution. I know how to convert a number to a hex string
> ToStrin("X"); but not the opposite way.
>
> Any help is highly appriciated.
>
> Thanks,
> Ole



 
Reply With Quote
 
Ole
Guest
Posts: n/a
 
      28th Aug 2006
Thanks,

I also found these standard methods - very easi to use:
Convert.ToString(number, 2); // where 2 specifies binary format - 8 would
be octal and so on
and:
Convert.ToUInt32(textBox2.Text, 2); // again 2 specifies binary format

Best regards
Ole

"Mark Jerde" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> There are several samples at codeproject. A few:
>
> http://www.codeproject.com/csharp/hexencoding.asp
> http://www.codeproject.com/csharp/hexconverter.asp
> http://www.codeproject.com/string/hexstrtoint.asp
>
> HTH.
>
> -- Mark
>
> Ole wrote:
>> Hi,
>>
>> I'm having 2 textboxes in which I enter binary numbers that must be
>> calculated to a third number that is shown in a third textbox. How do
>> i convert my entered binary number to an e.g an int and how do I
>> convert the calculated number to a binary string?
>>
>> If it's not possible straight away then hex could be the second
>> resolution. I know how to convert a number to a hex string
>> ToStrin("X"); but not the opposite way.
>>
>> Any help is highly appriciated.
>>
>> Thanks,
>> Ole

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Binary Numbers Sanford Lefkowitz Microsoft Excel Misc 9 12th May 2010 04:06 PM
Userform- Formating numbers in Textboxes =?Utf-8?B?T3pndXIgUGFycw==?= Microsoft Excel Programming 4 6th Jul 2006 10:01 AM
TextBoxes that accept only numbers Woody Splawn Microsoft VB .NET 6 25th Oct 2004 09:13 PM
Textboxes and Numbers Michael Turner Microsoft VB .NET 3 6th Aug 2004 02:07 PM
add numbers in textboxes on userform KimberlyC Microsoft Excel Programming 5 18th Sep 2003 06:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:45 AM.