Word Document Properties


Chapter 10: Working with Disk Files



Download 8,82 Mb.
Pdf ko'rish
bet191/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   187   188   189   190   191   192   193   194   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Chapter 10: Working with Disk Files
16_046500 ch10.qxp 12/5/06 5:36 PM Page 231


create performance logs when you suspect that your program doesn’t work
as fast as it could.
Program data storage should appear in a format that’s convenient for you
because you’re the only one who will see it. You should try to store the 
information by using the program itself. This is relatively easy to do with a
program such as Word or Excel. In some cases, you might want to go to the
extra trouble of creating the document by using indirect programming of
another application. See Chapter 16 for details on this technique. Finally, you
can use an informational Event Log entry to store the information.
When no other technique will work (or other techniques are just too inconve-
nient), you can always rely on a simple text file to store the program informa-
tion. The problem with using text files for complex data is that you can’t
format them, and they can’t contain information in easy-to-use formats, such
as graphs. The best reason to use a text file is that it’s an easy and conve-
nient method for storing text information.
Working with Settings
Many applications, including Windows, use INI files to store information. The
INI file has a standard format that is easy to work with. View any of the INI
files in the Windows folder, such as 
Win.INI
or 
System.INI
, and you see
two kinds of entry. The first is the section entry, which is surrounded by square
brackets, such as the 
[fonts]
section in the 
Win.INI
file. The second kind of
entry is a key-and-value pair. The key comes first and is separated from the
value by an equals sign.
You might need to create an INI file for your program. The INI file provides
the means for storing settings and restoring them later. The 
Dictionary
object provides the perfect means for working with INI settings because it
uses a key-and-value pair for storing information. The example in this section
shows how to read and write an INI file.
Writing an INI file
It pays to create one 
Dictionary
object for each section of your INI file.
Using the objects in this way makes it easy to quickly locate the information
that you need. The trade-off is that you have more objects to work with, and
your program will experience a small performance hit. Listing 10-1 contains
the code that you need to use a 
Dictionary
object to write to an INI file.
(You can find the source code for this example on the Dummies.com site at
http://www.dummies.com/go/vbafd5e
.)
232

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   187   188   189   190   191   192   193   194   ...   207




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish