Properties module - useful module for working with properties / ini files

Discussion in 'Code Samples & Tips' started by Erel, Nov 7, 2008.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Almost every application needs to use some sort of configuration file to store configurable values.
    The attached Properties module, can load and save keys and values in a simple syntax.
    This library uses hashtables from agraham's collections library to store the pairs of keys and values in an efficient data structure.
    You can use this module to work with any number of properties files.
    A (very) small example is also included in the zip file.
    Sub App_Start
    'Load an existing properties file:
        [B]p = Properties.Load("test.ini")[/B] 'Returns the handle to the properties table.
        ListBox1.Add("Width: " & [B]Properties.GetProperty(p,"Width")[/B])
    "Height: " & [B]Properties.GetProperty(p,"Height")[/B])
    "Name: " & [B]Properties.GetProperty(p,"Name")[/B])
    'Change some properties and save the file:
    "Name","New Name")
    End Sub
    The file syntax is:
    'This is a comment

    Name=Some Name

    Attached Files:

  2. hzimmer3

    hzimmer3 Member Licensed User


    I find this very interesting for handling property files,
    but I wonder how I can use this in Basic4Android.
    Do I need to include the library collection, how?


  3. Erel

    Erel Administrator Staff Member Licensed User

    This is a Basic4ppc library. You cannot use it in Basic4android. However it is very similar to File.ReadMap / WriteMap which are available in Basic4android.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice