Combo Box שלושה סוגים של Combo Box: Style 0 (default) - drop-down combo box המשתמש יכול להוסיף אפשרויות לרשימה או ללחוץ על החץ לבחירה מרשימת האפשרויות Style 1 - Simple combo box הרשימה מופיעה, אין חץ פתיחה. מאפשר למשתמש להוסיף אפשרויות Style 2 - Drop down list box הרשימה אינה מופיעה עד שלוחצים על החץ. אין אפשרות להוסיף אפשרויות לרשימה
Combo Box - גישה box.list(index) Text1.Text = List1.List(2) התכונה ListIndex - מציינת את המיקום של האלמנט הנבחר ListIndex יהיה (1-), אם לא נבחרה אפשרות או שהמשתמש הוסיף אפשרות התכונה ListCount מציינת את מספר האלמנטים ברשימה
Combo Box - גישה AddItem Removeitem Clear ListIndex ListCount List1.additem “germany” List1.additem “japan”, 0 List1.removeitem 0 List1.clear
Creating Menus By using the menu editor
תיבות דו - שיח שלוש דרכים להוסיף תיבות דו - שיח ליישום שלך : הוספת בקרים לטפסים שימוש בתיבות קלט ופלט (InputBox, MsgBox) שימוש בפקד CommonDialog על מנת להשתמש בתיבות דו - שיח סטנדרטיות כמו : Print, File open
תיבות דו - שיח נפוצות פקד CommonDialog Common Dialog מאפשר להציג את תיבות הדו - שיח הבאות : Open Save As Color Font Print
תיבות דו - שיח נפוצות פקד CommonDialog כדי להשתמש בפקד Common Dialog יש להוסיפו לסרגל הפקדים כך : לבחור Project Components לסמן את Microsoft Common Dialog Control
תיבות דו - שיח נפוצות פקד CommonDialog בזמן ריצה ניתן להשתמש בשיטות הבאות : MethodsDialog Displayed ShowOpenOpen ShowSaveSave As ShowColorColor ShowFontFont ShowPrinterPrint ShowHelpHelp
Open Dialog Box Private Sub mnuOpenItem_Click() CommonDialog1.Filter ="Metafiles_ (*.WMF)|*.WMF" CommonDialog1.ShowOpen Image1.Picture =_ LoadPicture(CommonDialog1.filename) mnuCloseItem.Enabled = True End Sub
Color Dialog Box Private Sub command1_Click() CommonDialog1.ShowColor End Sub
Modal Dialog Box Modal Dialog Box must be closed before you can continue working A Dialog Box is Modal if you click OK or CANCEL before you can switch To display a form as a modal dialog box use a style argument of 1 form1.show 1
Modeless Dialog Box Modeless Dialog Box let you shift the focus between the dialog box and another form without having to close the dialog box. Form1.show
Procedures פרוצדורות מחלקות את התוכנית למספר תוכניות קטנות פרוצדורות שנכתבו עבור פרוייקט אחד יכולות להיות בשימוש עבור פרוייקט אחר Sub procedures do not return a value Function procedures return a value Property procedures can return and assign a values, and set references to objects
Sub Procedures [Private|public][static]Sub procedurename (args) statements End Sub Sub is Public by default call MyProc(arg1,arg2) MyProc arg1,arg2
Function Procedures [Private|public][static]Function procname (args) [As Type] statements End Function As type is variant type by default Label1.Caption = func(y)
By Value Function func(ByVal x As Integer) As Integer x = 3 func = 4 End Function Private Sub Form_Load() Dim y As Integer y = 5 Label1.Caption = func(y) & "---" & y End Sub
By Reference Function func(Byref x As Integer) As Integer x = 3 func = 4 End Function Private Sub Form_Load() Dim y As Integer y = 5 Label1.Caption = func(y) & "---" & y End Sub