Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Read Ini file in two dimensional array?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joost - 29 Oct 2004 22:07 GMT
Hi,

I've got the following Ini file example

[Company]
Person=Joost Verdaasdonk
Adress=Nieuwe Huizen 115
Postal=4813 TM Breda
Tel=076-567800

What I'm trying to achieve is to call a section by:
Declare Function GetPrivateProfileString
(or something like that)

This Call should fill a two dimensional array (option
Base 1) with all the Keywords (eg; Person) and Entries
(eg; Joost Verdaasdonk) of that Section.

I've achieved that by looping through the keywords and
getting out one entry at a time.
This seams a lot off work and is slowing down the
procedure.

A while a go I saw an API that could retrieve all the
Keywords in a one dimensional Array.
But I cannot find that one. And if there is one, is there
also one that can retrieve all the Entries in a simular
array? (Two one dimenisionals also would be faster but
Two dimenisonal is preffered)

Does anybody has the code to fill lets say the variable:
sAnwer (Variant) with values of the example Ini?

The Array has to feed my bookmarks in the document. (But
that part is covered)

Thank you very much.

Groetjes,
Joost Verdaasdonk
JB - 01 Nov 2004 11:29 GMT
> Hi,
>
[quoted text clipped - 36 lines]
> Groetjes,
> Joost Verdaasdonk

Hi Joost,
I think I'm right in saying that as long as you continue with
PrivateProfileString and .ini files (which are slow anyway), your speed
will not be what you want.

You could just open the file for input and do a readline for each of the
lines in the file, loop through the 1 dimensional array you create
looking for your header then do the rest from there.

This however might not be what your looking for as it's extra coding to
scroll the array to find your data then split it up (it's not that bad
really but I don't know your skill level) but I think ity's faster than
.ini files.

HTH

J
Joost - 03 Nov 2004 19:10 GMT
Hi JB,

Thank you for this tip.
Read as Textfile is an option I'll consider. (but as you
said this will turn my coding upside down) ;-)

Regards,
Joost

>-----Original Message-----
>> Hi,
[quoted text clipped - 57 lines]
>
>.
azis - 01 Nov 2004 13:46 GMT
Joost,

Let er wel op dat de .ini file slechts 64K groot kan worden en derhalve bij
veel kontaktpersonen snel deze limiet bereikt. Wij hebben dit opgesliptst in
meerdere inifiles en een verwijzing naar een "master"ini file voor de
bedrijven. Indien interesse in de code svp hier melden.

> Hi,
>
[quoted text clipped - 36 lines]
> Groetjes,
> Joost Verdaasdonk
Joost - 03 Nov 2004 19:07 GMT
Hai Azis,

Bedankt voor de Tip!
Ik wist dat INI's een begrenzing hadden, maar hoeveel
wist ik niet.

Ik heb zeker interesse in jou code.
Je mag hem ook mailen naar: joostverdaasdonk BIJ hotmail
PUNT com (het logische vervangen en aanelkaar)

Alvast bedankt,
Joost Verdaasdonk

>-----Original Message-----
>Joost,
[quoted text clipped - 46 lines]
>
>.
Jonathan West - 01 Nov 2004 14:28 GMT
Hi Joost

the following article describes how to use the GetPrivateProfileSection API
call to load an entire section of an INI file.

Using INI Files to Save Application Data - Saving Entire Sections
http://vbnet.mvps.org/code/file/pprofilesections.htm

The code in the article loads an INI file section into a VB6 listbox. You'll
need to adapt it to load it into an array instead.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

> Hi,
>
[quoted text clipped - 36 lines]
> Groetjes,
> Joost Verdaasdonk
Joost - 03 Nov 2004 19:12 GMT
Hi Jonathan,

Most excellent stuff in the link you gave me!
This will come in hand at fase 2.

There I'll need to make a user interface (Form) to create
easy altering of the INI... (looks like I found how
now!) ;-)

Groetjes,
Joost Verdaasdonk

>-----Original Message-----
>Hi Joost
[quoted text clipped - 50 lines]
>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.