Hi,

As the title indicated, any ideas?

Basically I want to have a EditBox to enter network port number. I had using
convertion from text to number, but the results messed up with the following
codes;

Byte[] f_bytePort = System.Text.Encoding.ASCII.GetBytes(textBox_Port.Text);

Int32 Port;

Port = BitConverter.ToInt32(f_bytePort, 0);

Anyone know why I got messed up results?

Anyway, if there is a numericBox, then everything is solved.

Re: Is there a NumericBox rather than TextBox in C# compact .net by Sergey

Sergey
Thu Jun 09 07:32:22 CDT 2005

Try this instead:
int Port = Convert.ToInt32(_textBox_Port.Text);

Also you can restrict input to numeric only values using:
OpenNETCF.Windows.Forms.TextBoxEx with TextBoxStyle.Numeric.

--
Sergey Bogdanov
http://www.sergeybogdanov.com


Gravity wrote:
> Hi,
>
> As the title indicated, any ideas?
>
> Basically I want to have a EditBox to enter network port number. I had using
> convertion from text to number, but the results messed up with the following
> codes;
>
> Byte[] f_bytePort = System.Text.Encoding.ASCII.GetBytes(textBox_Port.Text);
>
> Int32 Port;
>
> Port = BitConverter.ToInt32(f_bytePort, 0);
>
> Anyone know why I got messed up results?
>
> Anyway, if there is a numericBox, then everything is solved.
>
>
>