For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Syntax > April 2005 > Parsing a fixed length string









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Parsing a fixed length string
John B

2005-04-06, 12:46 pm

I'm receiving a fixed length string with fixed length fields that I need to
break apart. Ideally I'd like to take the string and put it into a Structure
and then access the individual fields from there.

I tried converting the string to a byte array and then used a
Marshal.PtrToStructure to do the move but get a null reference exception in
mscorlib.dll. All the paramers look valid going into the call.

Any ideas how to fix the error or is there another way to do this?
Rick Rothstein

2005-04-06, 12:46 pm

Almost everybody in this newsgroup is using VB6 or lower. While you may
get a stray answer to VB.NET (including VB2003 and VB2005 which has
dropped .NET from its name) questions here, you should ask them in
newsgroups devoted exclusively to .NET programming. Look for newsgroups
with either the word "dotnet" or "vsnet" in their name.

For the microsoft news server, try these newsgroups for Visual Basic
..NET related questions...

microsoft.public.dotnet.languages.vb
microsoft.public.dotnet.languages.vb.upgrade
microsoft.public.dotnet.languages.vb.controls
microsoft.public.dotnet.languages.vb.data

And these for more general .NET questions

microsoft.public.dotnet.general
microsoft.public.vsnet.general

Note: There are many other .NET newgroups (use the first three "fields"
from the last two as templates when searching for them), but the above
ones should get you started.

Rick - MVP


> I'm receiving a fixed length string with fixed length fields that I

need to
> break apart. Ideally I'd like to take the string and put it into a

Structure
> and then access the individual fields from there.
>
> I tried converting the string to a byte array and then used a
> Marshal.PtrToStructure to do the move but get a null reference

exception in
> mscorlib.dll. All the paramers look valid going into the call.
>
> Any ideas how to fix the error or is there another way to do this?


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com