PC Review


Reply
Thread Tools Rate Thread

C# Hexadecimal conversion

 
 
=?Utf-8?B?TmFkYXY=?=
Guest
Posts: n/a
 
      10th Feb 2005
Hi,

I want to WriteLine a number in hexadecimal ( e.g. %x ), how would I do that
in C#?
--
Nadav
http://www.ddevel.com
 
Reply With Quote
 
 
 
 
sadhu
Guest
Posts: n/a
 
      10th Feb 2005
Use the ToString() method with the correct format specifier.
int x = 10;
Console.WriteLine(x.ToString("x"));

 
Reply With Quote
 
Jon Sagara
Guest
Posts: n/a
 
      10th Feb 2005
int nNum = 15;
Console.WriteLine ("Hex: {0:X}", nNum); // F
Console.WriteLine ("Hex: {0:x}", nNum); // f

X produces upper case hex, x produces lower case hex.


"Nadav" <(E-Mail Removed)> wrote in message
news:9AEA0AFF-881D-4022-8E2E-(E-Mail Removed)...
> Hi,
>
> I want to WriteLine a number in hexadecimal ( e.g. %x ), how would I do
> that
> in C#?
> --
> Nadav
> http://www.ddevel.com



 
Reply With Quote
 
Mark Reed
Guest
Posts: n/a
 
      11th Feb 2005


> int nNum = 15;
> Console.WriteLine ("Hex: {0:X}", nNum); // F
> Console.WriteLine ("Hex: {0:x}", nNum); // f
>
> X produces upper case hex, x produces lower case hex.
>


I'm a beginner, so pardon the simplicity of what I am about to ask...

Using this same goal, how would you make a form to input a word and have it
converted to hex and displayed in a label once a button is pressed?

 
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
Import hexadecimal data into excel keeping hexadecimal format Whale Microsoft Excel Misc 0 24th Feb 2010 03:08 AM
Hexadecimal conversion =?Utf-8?B?aG9ydGlndWVsYQ==?= Microsoft Excel Discussion 2 1st Feb 2007 09:30 PM
Hexadecimal to Binary Conversion sean_f Microsoft Excel Programming 4 4th Aug 2006 08:59 PM
Conversion of hexadecimal value to valid text =?Utf-8?B?SGVucnk=?= Microsoft VB .NET 2 13th Sep 2005 11:13 AM
96 bit binary to hexadecimal conversion akash deep batra Microsoft C# .NET 2 14th Jun 2004 11:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:38 AM.