Word Document Properties


Listing 7-7 Displaying a Form



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

Listing 7-7
Displaying a Form
Public Sub ShowAForm()
‘ Use the Show method to show a form.
‘ You can perform other tasks using a modeless form.
ButtonDemo.Show vbModeless
‘ A modal form requires that you complete the task 
‘ with that form before you proceed to other tasks.
NumericText.Show vbModal
End Sub
The problem that many developers face is deciding between a modal form
and a modeless form. Always use a 
modeless
form if you want to display
other forms or perform other tasks while the current form is displayed. Use a
modal
form when you want to ensure that any tasks for the current form are
complete before you display another form.
The example code shows both kinds of forms. You can try to select the
ButtonDemo
form, but you won’t be able to do it. The 
NumericText
form
insists that you complete tasks with it before you do anything else. As soon
as you finish working with the 
NumericText
form, the program completes.
VBA displays modeless forms and essentially forgets about them.
Validating user input
Always validate user input. The main source of security problems and many
types of application errors is user input. If the user doesn’t provide the 
175
Chapter 7: Interacting with the User
12_046500 ch07.qxp 12/5/06 5:35 PM Page 175


correct input, your program doesn’t run no matter how much effort you put
into it. In addition, many security exploits rely on poor program validation. A
buffer overrun,
one of the well-known causes of security problems, is simply
a failure to check input. Validating user input means that you should do the
following:
Always ensure that the input uses the correct data type.
Always check the range of numeric information.
If you want numbers
between 1 and 5, don’t let the user input anything else.

Download 8,82 Mb.

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