Null Data Problem

Scantech

Well-Known Member
Licensed User
Longtime User
Check the code below and wondering why Msgbox will not display. I have nothing in that key. or the key never been created. Test.ini does not contain the Key "Test". On the Debug screen Data shows the value Null. What am I doing wrong here?

B4X:
       Dim Map1 As Map   
       Map1 = File.ReadMap(File.DirRootExternal, "Test.ini")
      
      Dim Data As String
      Data = map1.Get("Test")
      
      If Data = Null Then 
         Msgbox("Yes","")
      End If
 

stevel05

Expert
Licensed User
Longtime User
You're probably better off using GetDefault where you can specify a return value if the entry doesn't exist.

Data = map1.GetDefault("Test","Not Found") then you can test for that.

If Data = "Not Found" ...
 
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
You're probably better off using GetDefault where you can specify a return value if the entry doesn't exist.

Data = map1.GetDefault("Test","Not Found") then you can test for that.

If Data = "Not Found" ...

I'll give it a shot. Thanks Steve.
 
Upvote 0
Top