SlideShare a Scribd company logo
1 of 45
aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf
Lists, Loops, and Printing Chapter 7 McGraw-Hill © 2006 The McGraw-Hill Companies, Inc. All rights reserved.
Objectives  (1 of 2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Objectives  (2 of 2) ,[object Object],[object Object],[object Object],[object Object],[object Object]
ListBoxes and ComboBoxes  (1 of 2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
List Boxes and Combo Boxes  (2 of2) Various Styles of List and Combo boxes
The Items Collection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Filling a List/Using the Properties Window ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Filling a List - Design Time Click ellipses button to open
Using the Items.Add Method ,[object Object],[object Object],[object Object],Object . Items . Add( ItemValue ) Me.schoolsListBox.Items.Add("Harvard " ) Me.schoolsListBox.Items.Add( " Stanford " ) Me.schoolsListBox.Items.Add(schoolsTextBox.Text) Me.majorsComboBox.Items.Add(majorsComboBox.Text) Me.majorsComboBox.Items.Add(majorString)
Using the Items.Insert Method ,[object Object],[object Object],[object Object],Me.schoolsListBox.Items.Insert(0,  " Harvard " ) Me.majorsComboBox.Items.Insert(1, Me.majorsComboBox.Text) Object . Items . Insert( IndexPosition ,  ItemValue )
The SelectedIndex Property ,[object Object],[object Object],[object Object]
The Items . Count Property ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Referencing the Items Collection ,[object Object],[object Object],Me.schoolsListBox.Items(5) = "University of California" '  Next line references the currently selected item. selectedFlavorString = flavorListBox.Items(flavorListBox.Selected Index).ToString( )
Removing an Item from a List ,[object Object],[object Object],[object Object],Me.namesListBox . Items . RemoveAt(0) ‘  Remove the item in position indexInteger. Me.schoolsComboBox.Items.RemoveAt(indexInteger) ‘  Remove the currently selected item. Object . Items . RemoveAt( IndexPosition )
The Items.Remove Method ,[object Object],[object Object],[object Object],namesListBox.Items.Remove("My School " ) schoolsComboBox.Items.Remove(schoolTextBox.Text) '  Next line removes the currently selected item. coffeeComboBox . Items . Remove(coffeeComboBox.Text) Object . Items . Remove( TextString )
Clearing a List ,[object Object],[object Object],[object Object],Me.schoolsListBox . Items . Clear( ) Me.majorsComboBox . Items . Clear( ) Object . Items . Clear( )
List Box and Combo Box Events ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Do/Loops ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Do and Loop Statements -General Form ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Top of Loop Condition, Pretest Bottom of Loop Condition, Posttest
Pretest vs. Posttest  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Pretest vs. Posttest Diagram
The Boolean Data Type Revisited ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
For/Next Loops ,[object Object],[object Object],[object Object],[object Object]
The For and Next Statements - General Form ,[object Object],[object Object],[object Object],A For/Next loop can handle all three elements of a counter-controlled loop Initialize the counter Increment the counter Test the counter to determine when it is time to  terminate the loop
For/Next Loop Diagram
Exiting Loops ,[object Object],[object Object],[object Object],[object Object]
Making Entries Appear Selected ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sending Information to the Printer ,[object Object],[object Object],[object Object],[object Object]
The PrintDocument Component ,[object Object],[object Object],[object Object]
Setting Up the Print Output ,[object Object],[object Object],[object Object],[object Object]
The Graphics Page ,[object Object],[object Object],[object Object],X coordinate is the horizontal distance from across the page; the Y coordinate is the vertical distance from the top of the page
Using the DrawString Method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The DrawString Method  General Form Examples DrawString(StringToPrint, Font, Brush, Xcoordinate, Ycoordinate) e.Graphics.DrawString(printLineString, printFont, Brushes.Black, _   horizontalPrintLocationSingle, verticalPrintLocationSingle) e.Graphics.DrawString("My text string", myFont, Brushes.Black, _   100.0, 100.0) e.Graphics.DrawString(nameTextBox.Text, New Font("Arial", 10), _   Brushes.Red, leftMarginSingle, currentLineSingle)
Setting the X and Y Coordinates ,[object Object],[object Object],Dim horizontalPrintLocationSingle As Single Dim verticalPrintLocationSingle As Single
PrintPageEventArgs ,[object Object],[object Object],[object Object],[object Object]
Printing the Contents of  List Box ,[object Object],[object Object],[object Object]
Aligning Decimal Columns ,[object Object],[object Object],[object Object],[object Object],[object Object]
Aligning Decimal Columns Code Example  (1 of 2) ' SizeF structure for font size info. Dim fontSizeF As New SizeF( )  ' Set X for left-aligned column. horizontalPrintLocationSingle = 200 ' Set ending position for right-aligned column. columnEndSingle = 500 ' Format the number. formattedOutputString= amountDecimal.ToString("C") ' Calculate the X position of the amount. ' Measure string in this font. fontSizeF= e.Graphics.MeasureString(formattedOutputString, _   printFont)
Aligning Decimal Columns Code Example  (2 of 2) ' SizeF structure for font size info (cont). ' Subtract width of string from the column position. columnXSingle = columnEndSingle - fontSizeF.Width ' Set up the line--each element separately. e.Graphics.DrawString("The Amount = ", printFont, _   Brushes.Black, horizontalPrintLocationSingle, _   verticalPrintLocationSingle) e.Graphics.DrawString(formattedOutputString, printFont, _   Brushes.Black, columnXSingle, verticalPrintLocationSingle) ' Increment line for next line. verticalPrintLocationSingle += lineHeightSingle
Displaying a Print Preview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
PrintPreviewDialog Component
The Using Block ,[object Object],[object Object],[object Object]
Printing Multiple Pages ,[object Object],[object Object]
Using Static Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

Similar to Chapter 07

Loop structures chpt_6
Loop structures chpt_6Loop structures chpt_6
Loop structures chpt_6
cmontanez
 
Please the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdfPlease the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdf
admin463580
 
Please solve the following problem using C++- Thank you Instructions-.docx
Please solve the following problem using C++- Thank you Instructions-.docxPlease solve the following problem using C++- Thank you Instructions-.docx
Please solve the following problem using C++- Thank you Instructions-.docx
PeterlqELawrenceb
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2pp
J. C.
 
hello- please dont just copy from other answers- the following is the.docx
hello- please dont just copy from other answers- the following is the.docxhello- please dont just copy from other answers- the following is the.docx
hello- please dont just copy from other answers- the following is the.docx
Isaac9LjWelchq
 
Chapter 06
Chapter 06Chapter 06
Chapter 06
llmeade
 
ContentsCOSC 2436 – LAB4TITLE .............................docx
ContentsCOSC 2436 – LAB4TITLE .............................docxContentsCOSC 2436 – LAB4TITLE .............................docx
ContentsCOSC 2436 – LAB4TITLE .............................docx
dickonsondorris
 
Advanced Spreadsheet Skills-1.pptx
Advanced Spreadsheet Skills-1.pptxAdvanced Spreadsheet Skills-1.pptx
Advanced Spreadsheet Skills-1.pptx
CliffordBorromeo
 
1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf
Javier Crisostomo
 

Similar to Chapter 07 (20)

CIS160 final review
CIS160 final reviewCIS160 final review
CIS160 final review
 
Java script basics
Java script basicsJava script basics
Java script basics
 
CIS-166 Midterm
CIS-166 MidtermCIS-166 Midterm
CIS-166 Midterm
 
Midterm Winter 10
Midterm  Winter 10Midterm  Winter 10
Midterm Winter 10
 
Cis160 Final Review
Cis160 Final ReviewCis160 Final Review
Cis160 Final Review
 
Loop structures chpt_6
Loop structures chpt_6Loop structures chpt_6
Loop structures chpt_6
 
Please the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdfPlease the following is the currency class of perious one- class Curre.pdf
Please the following is the currency class of perious one- class Curre.pdf
 
Please solve the following problem using C++- Thank you Instructions-.docx
Please solve the following problem using C++- Thank you Instructions-.docxPlease solve the following problem using C++- Thank you Instructions-.docx
Please solve the following problem using C++- Thank you Instructions-.docx
 
How to use vlookup in MS Excel
How to use vlookup in MS ExcelHow to use vlookup in MS Excel
How to use vlookup in MS Excel
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2pp
 
hello- please dont just copy from other answers- the following is the.docx
hello- please dont just copy from other answers- the following is the.docxhello- please dont just copy from other answers- the following is the.docx
hello- please dont just copy from other answers- the following is the.docx
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 
Chapter 06
Chapter 06Chapter 06
Chapter 06
 
ContentsCOSC 2436 – LAB4TITLE .............................docx
ContentsCOSC 2436 – LAB4TITLE .............................docxContentsCOSC 2436 – LAB4TITLE .............................docx
ContentsCOSC 2436 – LAB4TITLE .............................docx
 
9 - Advanced Functions in MS Excel.pptx
9 - Advanced Functions in MS Excel.pptx9 - Advanced Functions in MS Excel.pptx
9 - Advanced Functions in MS Excel.pptx
 
Basic controls in asp
Basic controls in aspBasic controls in asp
Basic controls in asp
 
Advanced Spreadsheet Skills-1.pptx
Advanced Spreadsheet Skills-1.pptxAdvanced Spreadsheet Skills-1.pptx
Advanced Spreadsheet Skills-1.pptx
 
1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf
 
easyPy-Basic.pdf
easyPy-Basic.pdfeasyPy-Basic.pdf
easyPy-Basic.pdf
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
 

More from Terry Yoast

More from Terry Yoast (20)

9781305078444 ppt ch12
9781305078444 ppt ch129781305078444 ppt ch12
9781305078444 ppt ch12
 
9781305078444 ppt ch11
9781305078444 ppt ch119781305078444 ppt ch11
9781305078444 ppt ch11
 
9781305078444 ppt ch10
9781305078444 ppt ch109781305078444 ppt ch10
9781305078444 ppt ch10
 
9781305078444 ppt ch09
9781305078444 ppt ch099781305078444 ppt ch09
9781305078444 ppt ch09
 
9781305078444 ppt ch08
9781305078444 ppt ch089781305078444 ppt ch08
9781305078444 ppt ch08
 
9781305078444 ppt ch07
9781305078444 ppt ch079781305078444 ppt ch07
9781305078444 ppt ch07
 
9781305078444 ppt ch06
9781305078444 ppt ch069781305078444 ppt ch06
9781305078444 ppt ch06
 
9781305078444 ppt ch05
9781305078444 ppt ch059781305078444 ppt ch05
9781305078444 ppt ch05
 
9781305078444 ppt ch04
9781305078444 ppt ch049781305078444 ppt ch04
9781305078444 ppt ch04
 
9781305078444 ppt ch03
9781305078444 ppt ch039781305078444 ppt ch03
9781305078444 ppt ch03
 
9781305078444 ppt ch02
9781305078444 ppt ch029781305078444 ppt ch02
9781305078444 ppt ch02
 
9781305078444 ppt ch01
9781305078444 ppt ch019781305078444 ppt ch01
9781305078444 ppt ch01
 
9781337102087 ppt ch13
9781337102087 ppt ch139781337102087 ppt ch13
9781337102087 ppt ch13
 
9781337102087 ppt ch18
9781337102087 ppt ch189781337102087 ppt ch18
9781337102087 ppt ch18
 
9781337102087 ppt ch17
9781337102087 ppt ch179781337102087 ppt ch17
9781337102087 ppt ch17
 
9781337102087 ppt ch16
9781337102087 ppt ch169781337102087 ppt ch16
9781337102087 ppt ch16
 
9781337102087 ppt ch15
9781337102087 ppt ch159781337102087 ppt ch15
9781337102087 ppt ch15
 
9781337102087 ppt ch14
9781337102087 ppt ch149781337102087 ppt ch14
9781337102087 ppt ch14
 
9781337102087 ppt ch12
9781337102087 ppt ch129781337102087 ppt ch12
9781337102087 ppt ch12
 
9781337102087 ppt ch11
9781337102087 ppt ch119781337102087 ppt ch11
9781337102087 ppt ch11
 

Recently uploaded

SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
MinawBelay
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
Krashi Coaching
 

Recently uploaded (20)

How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
Word Stress rules esl .pptx
Word Stress rules esl               .pptxWord Stress rules esl               .pptx
Word Stress rules esl .pptx
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
 
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptxHVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
HVAC System | Audit of HVAC System | Audit and regulatory Comploance.pptx
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdfFinancial Accounting IFRS, 3rd Edition-dikompresi.pdf
Financial Accounting IFRS, 3rd Edition-dikompresi.pdf
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 

Chapter 07

  • 1. aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf
  • 2. Lists, Loops, and Printing Chapter 7 McGraw-Hill © 2006 The McGraw-Hill Companies, Inc. All rights reserved.
  • 3.
  • 4.
  • 5.
  • 6. List Boxes and Combo Boxes (2 of2) Various Styles of List and Combo boxes
  • 7.
  • 8.
  • 9. Filling a List - Design Time Click ellipses button to open
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 23.
  • 24.
  • 25.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34. The DrawString Method General Form Examples DrawString(StringToPrint, Font, Brush, Xcoordinate, Ycoordinate) e.Graphics.DrawString(printLineString, printFont, Brushes.Black, _ horizontalPrintLocationSingle, verticalPrintLocationSingle) e.Graphics.DrawString("My text string", myFont, Brushes.Black, _ 100.0, 100.0) e.Graphics.DrawString(nameTextBox.Text, New Font("Arial", 10), _ Brushes.Red, leftMarginSingle, currentLineSingle)
  • 35.
  • 36.
  • 37.
  • 38.
  • 39. Aligning Decimal Columns Code Example (1 of 2) ' SizeF structure for font size info. Dim fontSizeF As New SizeF( ) ' Set X for left-aligned column. horizontalPrintLocationSingle = 200 ' Set ending position for right-aligned column. columnEndSingle = 500 ' Format the number. formattedOutputString= amountDecimal.ToString("C") ' Calculate the X position of the amount. ' Measure string in this font. fontSizeF= e.Graphics.MeasureString(formattedOutputString, _ printFont)
  • 40. Aligning Decimal Columns Code Example (2 of 2) ' SizeF structure for font size info (cont). ' Subtract width of string from the column position. columnXSingle = columnEndSingle - fontSizeF.Width ' Set up the line--each element separately. e.Graphics.DrawString("The Amount = ", printFont, _ Brushes.Black, horizontalPrintLocationSingle, _ verticalPrintLocationSingle) e.Graphics.DrawString(formattedOutputString, printFont, _ Brushes.Black, columnXSingle, verticalPrintLocationSingle) ' Increment line for next line. verticalPrintLocationSingle += lineHeightSingle
  • 41.
  • 43.
  • 44.
  • 45.

Editor's Notes

  1. Brief description on how to navigate within this presentation (ppt) The first time a Key Term from the chapter is used in the ppt it will display in blue Gold colored text boxes display coding examples Slides will be numbered (# of #) when multiple slides on same topic (Slide title) Speaker notes are included where appropriate for slides (*)Denotes either a comment for page reference to textbook or slide reference in ppt
  2. Often there is a want to offer the user a list of items from which to choose-the Windows ListBox and ComboBox controls (key term) can be used to display lists on a form Items may be added to a list during design time, run time, or perhaps a combination of both
  3. When adding a list control to a form, choose the style according to the space that is available and the box is to operate At design time, the behavior of list boxes and combo boxes differs—for list boxes VB displays the Name property in the control; for combo boxes the Text property displays which is blank by default Combo boxes have a Text property which can be set at design time; List boxes also have a Text property it can only be accessed at run time
  4. Items in a collection can be referred to by an index, which is zero based—for example, if a collection holds 10 items, the indexes to refer to the items range from 0 to 9; the first tiem in the Items collection would be Item 0
  5. Several methods can be used to fill the Items collection of a List box and Combo box. If the list contents are known at design time and the list never changes, it can be defined in the Properties window If items must be added to the list during program execution the Items.Add or Items.Insert method (key term) in an event procedure is used
  6. Items to add can be a variable, a constant, the contents of the Text box at the top of a Combo box, or the Text property of another control
  7. The index position is zero based-to insert a new item in the first position, use index position = 0
  8. The SelectedIndex Property is used when a project is running and the user selects (highlights) an item from the list
  9. Used to display one item from a list-refer to one element of the Items collection Specify which element is wanted by including an index This technique can be useful if needed to display a list item in a label or on another form
  10. In addition to removing individual items at run time, items can also be cleared from a list
  11. The computer is capable of repeating a group of instructions many times without calling the procedure for each new set of data—the process is called looping
  12. *Next slide shows examples of prettest and posttest loops
  13. Boolean variables can be very useful when setting and testing conditions for a loop Can be used to search through a list for a specific value Three step process-dimension a variable; set its initial value and then set a variable to True
  14. The For/Next loop uses the For and Next statements as well as a counter variable called the loop index
  15. The next slide shows a For/Next loop diagram
  16. If in an endless loop that can be caused by changing the value of a loop index variable the program execution may need to be broken manually
  17. There are several techniques used to make the text in a text box or list appear selected
  18. .NET PrintDocument and PrintPreviewDialog components can be used to produce output for the printer and also to preview the output on the screen
  19. The logic for the actual printing belongs in the PrintDocument’s PrintPage event procedure (Key term)
  20. Exact locations needs to be specified for each element of the graphics pages that is to be printed You can specify the upper-left corner of any element by giving its X and Y coordinates, or by using a Point structure or a Rectangle structure You can use multiple PrintDocument objects if you have more than one type of output or report Each PrintDocument has its own PrintPage event Code the graphics commands to precisely print the page in each document’s PrintPage event procedure
  21. The next slide displays the General Form and examples of the DrawString Method
  22. If printing a selected Item from a List—the Text property holds the selected item and can be used to print that selected item
  23. The next 2 slides display an example of sample code for Aligning Decimal Columns
  24. A really great new feature of the new VB.NET printing model is print preview It’s easy to view the printer’s output on the screen and then decide to print or cancel *The next slide displays the PrintPreview Dialog Component