There are several other mistakes that you should avoid:
Dim MyMap As Map
MyMap.Initialize
MyMap=File.Readmap(File.DirInternal, "maptrivia")
Don't initialize the object if you are assigning a different object to the same variable.
Correct:
Dim MyMap As Map = File.ReadMap(...)
Never use GetValueAt or GetKeyAt.
Iterating over a map:
For Each Key As Object In MyMap.Keys 'change Object to correct type if type is known
Dim Value As StudentType = MyMap.Get(Key)
Next
'you can also iterate over the values:
[code]
For Each Student As StudentType In MyMap.Values
Next
As you wrote, File.WriteMap / ReadMap is only good for simple values as it creates a text file. You should either use B4XSerializator and save the data with File.WriteBytes or just choose the best option which is to use KeyValueStore2.