Preferred Hex conversion in C#

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
snieves77
Posts: 4
Joined: Thu 11. May 2017, 22:02

Preferred Hex conversion in C#

Post by snieves77 » Mon 11. Sep 2017, 18:59

Is there a preferred hex conversion for can data? In c# I'm using Convert.ToInt32(fields[0], 16). Is this correct? Any help would be greatly appreciated.

K.Wagner
Software Development
Software Development
Posts: 1080
Joined: Wed 22. Sep 2010, 13:36

Re: Preferred Hex conversion in C#

Post by K.Wagner » Tue 12. Sep 2017, 11:27

Hello,

yes. It is OK. Check the PCAN-Basic samples. In there you will find a lot of code in C# (and other languages). For instance:

Code: Select all

// We configurate the Message.  The ID,
// Length of the Data, Message Type
// and the data
//
CANMsg.ID = Convert.ToUInt32(txtID.Text, 16);
Best regards,
Keneth

snieves77
Posts: 4
Joined: Thu 11. May 2017, 22:02

Re: Preferred Hex conversion in C#

Post by snieves77 » Tue 12. Sep 2017, 17:13

Perfect, thanks!

Post Reply