VB.NET Cheat Sheet By: Andrew Kiceniuk

VB.NET Cheat Sheet By: Andrew Kiceniuk

<p>VB.NET Cheat Sheet By: Andrew Kiceniuk Unit 3: Iteration Three Basic Looping Structures: Note: In all three looping structures outlined below the code inside the loop will repeat, so long as the condition evaluates to true. As soon as the condition is false, the loop is broken and the code inside the loop will no longer execute.</p><p>1. Do  is best used when you want code to repeat for an unfixed number of times  always executes the code inside the loop at least once because the condition is at the end of the loop</p><p>General Structure Code Example</p><p>Do Do ‘execute the code strName = InputBox(“Enter Name”) ‘listed here strAllNames = strAllNames & strName Loop While condition = true Loop While strName <> “”</p><p>Note: strName will equal “” if no input is entered into the InputBox, or if the ‘Cancel’ button is pressed on the InputBox</p><p>2. While  code inside the loop is may not execute at all, because the condition is at the beginning of the loop</p><p>General Structure Code Example</p><p> strPlay = InputBox(“Want To Play?”) Do While condition = true Do While strPlay = “YES” ‘execute the code ‘code for a game ‘listed here ‘code for a game Loop Loop </p><p>3. For  is best used when you want code to repeat a fixed number of times  a counter variable is necessary for this looping structure  after the loop executes the code inside the loop it will by default increase the counter by 1  use the keyword ‘Step’ to count up or down by a value other than the default of 1</p><p>General Structure Code Example</p><p>For counter To number For intIndex = 1 To 10 ‘execute the code strNumbers += vbCrLf & intIndex ‘listed here Next intIndex Next counter Me.txtNumbers.Text = strNumbers VB.NET Cheat Sheet By: Andrew Kiceniuk Unit 3: Iteration General Structure For Specified Counter Values Code Example For counter To number Step number For intIndex = 1 To 10 Step 2 ‘execute the code strNumbers += vbCrLf & intIndex ‘listed here Next intIndex Next counter Me.txtNumbers.Text = strNumbers</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us