Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Code Samples & Tips Share your recent discoveries and ideas with other users.

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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-07-2008, 09:01 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default Properties module - useful module for working with properties / ini files

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.
Code:
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>)
    ListBox1.Add(
"Height: " & <b>Properties.GetProperty(p,"Height")</b>)
    ListBox1.Add(
"Name: " & <b>Properties.GetProperty(p,"Name")</b>)
    Form1.Show
    
    
'Change some properties and save the file:
    <b>Properties.AddProp(p,"Width",333)
    Properties.AddProp(p,
"Height",111)
    Properties.AddProp(p,
"Name","New Name")
    Properties.Save(p,
"test.ini")</b>
End Sub
The file syntax is:
Code:
'This is a comment
'
Key=Value

Width=
200
Name=Some Name
Height=
300
Attached Files
File Type: zip Properties.zip (6.8 KB, 187 views)
__________________
Basic4android documentation
Reply With Quote
  #2 (permalink)  
Old 10-13-2011, 08:12 PM
Newbie
 
Join Date: Sep 2011
Posts: 8
Default Properties

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?

Thanks,

Helmut
Cologne/Germany
Reply With Quote
  #3 (permalink)  
Old 10-13-2011, 10:02 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

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.
__________________
Basic4android documentation
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Disappointed with Module Support epsharp Basic4ppc Wishlist 12 11-04-2008 01:56 PM
passing a module name as a variable Cableguy Questions (Windows Mobile) 4 10-24-2008 10:47 AM
Fragen: Kamera und C-Module navi55 German Forum 2 09-26-2008 11:07 AM
Storage of module klaus Beta Versions 6 08-31-2008 03:36 PM
HiLo Game Module Wizarda2z Share Your Creations 0 05-12-2007 07:43 PM


All times are GMT. The time now is 05:33 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0