Word Document Properties


Part II: Learning the Ropes



Download 8,82 Mb.
Pdf ko'rish
bet140/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   136   137   138   139   140   141   142   143   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Part II: Learning the Ropes 
12_046500 ch07.qxp 12/5/06 5:35 PM Page 160


The second label contains 
Message Output:
in the 
Caption
property. This
label receives the output from the 
TextBox
when you click the Test button.
Here’s some sample code that shows the 
btnTest_Click
event handler.
(You can find the source code for this example on the Dummies.com site at
http://www.dummies.com/go/vbafd5e
.)
Private Sub btnTest_Click()
‘ Move the information from the TextBox input to the
‘ label output.
lblOutput.Caption = “Message Output: “ + vbCrLf + _
txtInput.Text
End Sub
VBA executes this code whenever you click the Test button. The name of the
control is 
btnTest
, and the name of the event is 
Click
, so the name of the
Sub
is 
btnTest_Click
. The result of this code is that 
lblOutput
, the output
label, contains the text that it originally contained plus the contents of the
TextBox
control, 
txtInput
.
You might wonder why I begin the control names in this example with 
lbl
,
txt
, or 
btn
. The most important reason why I use this naming strategy (or
notation
) is that VBA sorts the controls for me so that I can quickly find the
one that I want. For example, Figure 7-4 shows the object list in the Properties
window. Notice that using the notation makes it easy to find the controls.
Getting user input with text boxes
The 
TextBox
control makes it possible to request information from the user.
This control doesn’t have a 
Caption
property because it doesn’t provide
any visual identification. You should always use the 
TextBox
control with a
Label
control, as shown in Figure 7-4, so that everyone can see what kind of
input the 
TextBox
is supposed to get.

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   136   137   138   139   140   141   142   143   ...   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