I need to develop software for hardware. In the text box the enduser enters numeric values only for example 6. That I need to interpret as decimal 006 (hex 0x06) and not as decimal 036 (hex 0x36) which is the value of interger 6.
I have no clue how to do it.
If I use convert.toDecimal("6") I get the value 036 which is correct but not for my application. If the enduser inputs 234 it must be stored in a variable as Decimal 234

found the answer

byte cyl = Convert.ToByte(txtNoCyl.Text);            
            string index1 = UTF8Encoding.UTF8.GetString(new byte[] { 0 });
            string cyl1 = UTF8Encoding.UTF8.GetString(new byte[] { cyl });
            sP1.Write(setupDataSend + index1 + cyl1);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.