Version 2.7 Type structure

Rusty

Well-Known Member
Licensed User
Longtime User
I have just upgraded to 2.7 and am compiling a program that has been running under the previous versions of the compiler just fine.
Now I am receiving an "Object reference not set ot an instance of an object." on a type structure:
B4X:
Type MRN(MRNID As String, FirstName As String, LastName As String, DOB As String)
Dim MRNInfo(100) As MRN
In the code the following generates the above mentioned error:
B4X:
For ii = 0 to 10
     MRNInfo(ii).Initialize
     MRNInfo(ii).MRNID = ""   '<---<< this line generates the error
next
However, the below code works fine...
B4X:
Dim M As MRN
M.Initialize
M.MRNID = ""
I don't understand why this is happening.
Any thoughts would be greatly appreciated.
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
I think I figured it out...
In preparing a sample program to send to you for your evaluation, I discovered that the previous compiler will allow a module name and a variable name to be the same.
The new compiler won't.
For example:
Within the module name MRN
B4X:
Type MRN(MRNID As String, FirstName As String, LastName As String, DOB As String)
    Dim MRNInfo() As MRN
Causes the above error
In creating the test program, I discovered that
B4X:
Type MRNx(MRNID As String, FirstName As String, LastName As String, DOB As String)
    Dim MRNInfo() As MRNx
does work.
Thanks Erel,
Rusty
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…