0

Greetings again

I have a small utility that reports which printer port has been selected.

Its returning the correct data, but in binary, LPT 1 = 0x378 = 888

Right now its reports in the message box "Printer Port 888"

I would like to change that to read "Printer Port x" as in Printer Port 1 or 2 or 3 and so on...

How would I convert the binary info to generic number?


The snippet below has the two lines of interest.

private ushort m_portBase = 0;

MessageBox.Show("Printer Port " + m_portBase);
3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by __avd
0

Hi,
You could try this:

int PrinterPort = Convert.ToInt32(<The binary Value>,2);

Hope it works :)

Edited by Alexpap: n/a

0

I must be missing something.

int PrinterPort = Convert.ToInt32(m_portBase, 2);

resulted in ;

Error 1 The best overloaded method match for 'System.Convert.ToInt32(object, System.IFormatProvider)' has some invalid arguments

Error 2 Argument '2': cannot convert from 'int' to 'System.IFormatProvider'

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.