troubleshooting Question

Problem in Variant Parts

Avatar of srisha
srisha asked on
19 Comments1 Solution498 ViewsLast Modified:
Hi all,

I have a strange problem.

I have defined a packed record in Delphi 2005(for .NET) which looks like this:

TAccount = Packed Record
    Case Integer of
    0: (
      Account  : Array of Char;    
    1: (
      Currency   : Array of Char;      
      Member       : Array of Char;    
      Customer : Array of Char;      
      Group   : Array of Char;      

I have removed the array lengths as it is not supported in .NET in variant records. I have defined var of TAccountNo as say ACNo.

The problem is let say I assign '0123456789' to ACNo.Account, it automatically assign whole of it to first one, Currency and Member,Customer &group are all empty.

Is there any method by which I can split the first part and assign it the second, I mean
ACNo.Account = 0123456789
then Currency = 01
       Member = 23
       CustomerNo = 45678
       group = 9

I have tried with setting the length of array dynamically, it won't work as array is now reference type(If I am correct) and will be stored as pointers of length 16 bytes.

Can anybody help me out?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 19 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros