Word Document Properties


Part II: Learning the Ropes



Download 8,82 Mb.
Pdf ko'rish
bet147/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   143   144   145   146   147   148   149   150   ...   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 170


property to determine which entries are highlighted. The 
Value
property is
always 
Null
(set to nothing) when you allow multiple selections.
Both of these controls require less code than the 
OptionButton
control to
perform approximately the same task. Listing 7-6 shows an example of both
the 
ComboBox
and the 
ListBox
in action. (You can find the source code for
this example on the Dummies.com site at 
http://www.dummies.com/go/
vbafd5e
.)
Listing 7-6
Working with List Boxes and Combo Boxes
Private Sub btnStatus_Click()
‘ Create an output string.
Dim Output As String
Output = “The selected color is: “ + _
comboColors.Value + vbCrLf + _
“The selected number is: “ +
listNumbers.Value
‘ Display the result.
MsgBox Output
End Sub
Private Sub UserForm_Initialize()
‘ Populate the ListBox control.
listNumbers.AddItem “One”
listNumbers.AddItem “Two”
listNumbers.AddItem “Three”
listNumbers.AddItem “Four”
listNumbers.AddItem “Five”
listNumbers.AddItem “Six”
‘ Select the default value.
listNumbers.Value = “One”
‘ Populate the ComboBox control.
comboColors.AddItem “Red”
comboColors.AddItem “Green”
comboColors.AddItem “Blue”
comboColors.AddItem “Yellow”
comboColors.AddItem “Orange”
comboColors.AddItem “Purple”
‘ Select the default value.
comboColors.Value = “Red”
End Sub
The code begins in the 
UserForm_Initialize
sub-procedure. You must
populate the two controls by using the 
AddItem
method. Setting the 
Value
property to one of the values that you provide selects that value in the list.
171

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   143   144   145   146   147   148   149   150   ...   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