Word Document Properties


Chapter 9: Working with Arrays and Collections



Download 8,82 Mb.
Pdf ko'rish
bet184/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   180   181   182   183   184   185   186   187   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Chapter 9: Working with Arrays and Collections
15_046500 ch09.qxp 12/5/06 5:36 PM Page 221


variable also has a name. VBA helps you create user-defined types of any
complexity. They can include arrays, other user-defined types, and even
objects. However, you always want to make the user-defined type as simple
as possible and document it fully so that you remember later what it does.
Knowing when to create 
your own data type
Before you create a user-defined data type, always ask whether any existing
type (including objects and collections) can fulfill your need. After you know
that you have to create a user-defined type, make sure that you think about
the purpose that the user-defined type fulfills.
A user-defined data type can save time and effort by letting you declare all
the data elements that you normally use together for a task in one place. It
can also group data so that you don’t have to perform finger gymnastics to
locate your data. However, the main reason to create a user-defined type is to
make your program easier to understand. A well-defined data type can make
your code simpler and keep the number of code lines to a minimum.
Accessing and manipulating data
The example in the earlier “Adding keyed data to the collection” section
works well because it doesn’t have to work with complex data. A program
that modifies multiple tables and 20 or 30 fields might not work so well by
using the technique shown in that section. (It would work, but it wouldn’t be
fun to program.) By using the new data type that you just created, you can
make the programming example in the “Adding keyed data to the collection”
section easier to understand.
The example in this section relies on a user-defined data type. It builds an
object on that data type and then adds the object to a collection. This exam-
ple shows how to create your own collections to make working with your
data faster and easier.
Defining an individual contact
When you decide to create your own collection, begin with the individual
object. Make sure that you know what one copy of an object looks like before
you create multiple copies of it. See Chapter 8 for a complete object creation
demonstration.
222

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   180   181   182   183   184   185   186   187   ...   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