VB NOTES PART 7

VB NOTES PART 7 - ElseIf . . Else displayLabel.Text=...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
2/15 ---Counter-controlled iteration requires - Control variable - Initial value - Increment (or decrement) - Condition to check for final value (stopping condition to avoid infinite loop) ---simpler: For…Next Dim ctr As Integer For ctr=1 To 10 Step 1 ----------- optional…default: add 1 ‘do sth Next Notebook (graph) Condition is implicit now Ctr <= 10 Determined by sign of step For ctr=10 To 1 step 1-1 (if counting down, add”-1” because the default is +10) For ctr As Integer =7 (can declare in the loop if not going to use it anywhere else) For ctr As Integer = 1To2*X step 1 . . X +=2 Next (executed 14 times-condition doesn’t change) 2/17 Multicase selection If grade = “A” Then displayLabel.Text=”Excellent” ElseIf grade= “B” Then displayLabel.Text= “Very Good”
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ElseIf . . Else displayLabel.Text= Invalid EndIf OR Select Case grade Case A displayLabel.Text= Excellent cond 1 True Action 1 Case B displayLabel.Text= Very Good False . . cond 2 True Action 2 Case Else displayLabel.Text= Invalid Optional False End Select-----Notes-------------Executes first matching case only Default Action Each case is followed by an expression list Case 29 Case 27 to 43 Case 14, 15, 18 Case Is&lt; 27 Case 12, -3 To 3, Is &gt; 41 (not recommendedeasy to get confused) My string = number &amp; _ controlChars.Tab &amp; _ Number * number Val (123) ------- 123 number a hundred and twenty three Str (123) -------one two three...
View Full Document

Page1 / 2

VB NOTES PART 7 - ElseIf . . Else displayLabel.Text=...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online