Hi I am persuing MCA and I am doing my 6th sem project on vb.net 2003 and i have problem.In my project i have to read data from a .txt file and display the data in the excel sheet.The data in the txt file is in hex and the pattern of the data is as shown below
85 1F 04 56 34 2E 33 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5A 5A 52 52 58 58 58 58 58 58 20 20 64
85 0D 15 01 46 45 4E 54 41 4E 59 4C 20 20 20 3A
85 0D 15 02 56 45 52 53 45 44 20 20 20 20 20 29
85 0D 15 03 4D 49 44 41 5A 4F 4C 41 4D 20 20 4F
85 0D 15 04 4D 4F 52 50 48 49 4E 45 20 20 20 36
85 0D 15 05 44 45 4D 45 52 4F 4C 20 20 20 20 45

So when 85 is encountered i want to disply it in new row....
please help me....If you know how to do this please help me and do me the favour.....please
Thanks you very very very much in advance...

- Read every hex 85, 1F, etc
- Parse every hex to covert it to char

Dim c as char
c = (char)int.Parse(hex, System.Globalization.NumberStyles.HexNumber)

- you can add 'if' statement to escape 85 and replace it with '\r\n'

Here's a VB.NET version of the code above (this is a VB.NET forum :) )
Dim c As Char
c = CChar(CStr(Integer.Parse(Hex, System.Globalization.NumberStyles.HexNumber)))

and instead of '\r\n', use Environment.NewLine

Comments
He has corrected my code

Thanks Teme, so much, I tried to convert my C# knowledge to VB.NET but seems it doesn't work :D
Thank you so much really..

This article has been dead for over six months. Start a new discussion instead.