Word Document Properties


Always check the value of text input whenever possible



Download 8,82 Mb.
Pdf ko'rish
bet151/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   147   148   149   150   151   152   153   154   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Always check the value of text input whenever possible.
If you’re
expecting an address, look for elements in the text that make up an
address.
Never allow the user to input special characters unless you actually
need the special characters to make the input work.
Keep input simple enough that the user knows what you want and it’s
easy to check.
For example, use separate entries for city, state, and zip
code in a contact management program.
Handling form events
Events are a part of most objects. Whenever the system, a user, or an exter-
nal input interacts with your program, it’s likely to generate an event. For
example, when you click a button, it generates a 
Click
event. An 
event
is
simply a way of saying that something has happened.
Forms and every control that they contain support a number of events. Look
at the top of the Code window, and you see two Combo Boxes. The first is the
Object list. It contains a list of every object associated with the current form.
Figure 7-8 shows an example of this list. The UserForm entry is the actual
form object.
Figure 7-8:
Use the
Object list 
to select
objects
associated
with the
current
form.
176
Part II: Learning the Ropes 
12_046500 ch07.qxp 12/5/06 5:35 PM Page 176


Whenever you select an object, VBA automatically creates a sub-procedure
for the default event that the object supports (the 
Click
event in many
cases). You can remove this entry if you’re interested in writing code for
some other event.
The second Combo Box is the Procedure list. Figure 7-9 shows an example of
this list box. The Procedure list contains a list of events associated with the
current object. This list changes when you change entries in the Object list.
When you look through the Procedure list, notice that some entries are in
bold. A bolded entry is one that you’ve added to the program. The entries
shown in normal text are events that you can choose to handle but haven’t
so far. To add a new event handler to the program, simply select the entry
from the Procedure list. VBA adds the event 
Sub
to your code — type your
code within this 
Sub
to handle the event.
Figure 7-9:
Use the
Procedure
list to select
events
associated
with the
current
object.
177

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   147   148   149   150   151   152   153   154   ...   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