Using Compound Assignment and Iteration Statements in .NET framework

Encode PDF-417 2d barcode in .NET framework Using Compound Assignment and Iteration Statements

5
PDF417 Printer In .NET Framework
Using Barcode generation for ASP.NET Control to generate, create PDF-417 2d barcode image in ASP.NET applications.
www.OnBarcode.com
Barcode Generation In .NET Framework
Using Barcode generation for ASP.NET Control to generate, create bar code image in ASP.NET applications.
www.OnBarcode.com
Using Compound Assignment and Iteration Statements
Make PDF 417 In C#
Using Barcode creator for .NET framework Control to generate, create PDF417 image in .NET applications.
www.OnBarcode.com
PDF417 Creator In VS .NET
Using Barcode maker for Visual Studio .NET Control to generate, create PDF-417 2d barcode image in .NET applications.
www.OnBarcode.com
This statement declares a char variable called digit and initializes it to the result of the Convert.ToChar(digitCode) method call. The Convert.ToChar method takes an integer holding a character code and returns the corresponding character. So, for example, if digitCode has the value 54, Convert.ToChar(digitCode) will return the character 6 . To summarize, the rst three statements in the do loop have determined the character representing the least-signi cant (rightmost) octal digit corresponding to the number the user typed in. The next task is to prepend this digit to the string being output, like this:
Draw PDF 417 In Visual Basic .NET
Using Barcode creator for .NET framework Control to generate, create PDF417 image in VS .NET applications.
www.OnBarcode.com
Printing 1D In Visual Studio .NET
Using Barcode generator for ASP.NET Control to generate, create Linear 1D Barcode image in ASP.NET applications.
www.OnBarcode.com
current = digit + current;
USS Code 39 Generation In VS .NET
Using Barcode encoder for ASP.NET Control to generate, create Code 3 of 9 image in ASP.NET applications.
www.OnBarcode.com
Create Data Matrix 2d Barcode In .NET Framework
Using Barcode drawer for ASP.NET Control to generate, create Data Matrix ECC200 image in ASP.NET applications.
www.OnBarcode.com
The next statement inside the do loop is this:
European Article Number 13 Generation In .NET
Using Barcode creation for ASP.NET Control to generate, create EAN-13 image in ASP.NET applications.
www.OnBarcode.com
Creating EAN / UCC - 14 In Visual Studio .NET
Using Barcode printer for ASP.NET Control to generate, create USS-128 image in ASP.NET applications.
www.OnBarcode.com
steps.Text += current + \n ;
UPC-A Supplement 2 Creation In .NET Framework
Using Barcode generator for ASP.NET Control to generate, create UPC Symbol image in ASP.NET applications.
www.OnBarcode.com
ANSI/AIM I-2/5 Drawer In .NET
Using Barcode maker for ASP.NET Control to generate, create Uniform Symbology Specification ITF image in ASP.NET applications.
www.OnBarcode.com
This statement adds to the Steps text box the string containing the digits produced so far for the octal representation of the number. The nal statement inside the do loop is
Make PDF-417 2d Barcode In Java
Using Barcode generation for Android Control to generate, create PDF417 image in Android applications.
www.OnBarcode.com
UPC - 13 Recognizer In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
amount /= 8;
Drawing Bar Code In Objective-C
Using Barcode drawer for iPhone Control to generate, create barcode image in iPhone applications.
www.OnBarcode.com
Quick Response Code Decoder In Visual C#
Using Barcode reader for .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
This is a compound assignment statement and is equivalent to writing amount = amount / 8;. If the value of amount is 2693, the value of amount after this statement runs is 336. Finally, the condition in the while clause at the end of the loop is evaluated:
Code 128A Creator In None
Using Barcode drawer for Excel Control to generate, create Code 128C image in Office Excel applications.
www.OnBarcode.com
Code 39 Extended Maker In None
Using Barcode generator for Microsoft Word Control to generate, create Code 39 image in Word applications.
www.OnBarcode.com
while (amount != 0)
ECC200 Drawer In Java
Using Barcode drawer for Android Control to generate, create DataMatrix image in Android applications.
www.OnBarcode.com
DataMatrix Creation In Java
Using Barcode encoder for Eclipse BIRT Control to generate, create ECC200 image in BIRT applications.
www.OnBarcode.com
Because the value of amount is not yet 0, the loop performs another iteration. In the nal exercise, you will use the Visual Studio 2008 debugger to step through the previous do statement to help you understand how it works.
Step through the do statement
1. In the Code and Text Editor window displaying the Window1.xaml.cs le, move the cursor to the rst statement of the showStepsClick method:
int amount = int.Parse(number.Text);
2. Right-click anywhere in the rst statement, and then click Run To Cursor. 3. When the form appears, type 2693 in the upper text box, and then click Show Steps. The program stops, and you are placed in Visual Studio 2008 in debug mode. A yellow arrow in the left margin of the Code and Text Editor window indicates the current statement.
Part I
Introducing Microsoft Visual C# and Microsoft Visual Studio 2008
4. Display the Debug toolbar if it is not visible. (On the View menu, point to Toolbars, and then click Debug.) 5. On the Debug toolbar, click the Windows drop-down arrow. Note The Windows icon is the rightmost icon in the Debug toolbar. The following menu appears:
Note If you are using Microsoft Visual C# 2008 Express Edition, the shortcut menu that
appears contains a subset of those shown in the following image.
6. On the drop-down menu, click Locals. The Locals window appears (if it wasn t already open). This window displays the name, value, and type of the local variables in the current method, including the amount local variable. Notice that the value of amount is currently 0:
5
Using Compound Assignment and Iteration Statements
7. On the Debug toolbar, click the Step Into button. The debugger runs the statement:
int amount = int.Parse(number.Text);
The value of amount in the Locals window changes to 2693, and the yellow arrow moves to the next statement. 8. Click Step Into again. The debugger runs the statement:
steps.Text = ;
This statement does not affect the Locals window because steps is a control on the form and not a local variable. The yellow arrow moves to the next statement. 9. Click Step Into. The debugger runs the statement:
string current = ;
The yellow arrow moves to the opening brace at the start of the do loop. 10. Click Step Into. The yellow arrow moves to the rst statement inside the do loop. The do loop contains three local variables of its own: nextDigit, digitCode, and digit. Notice that these local variables appear in the Locals window, and that the value of all three variables is 0. 11. Click Step Into. The debugger runs the statement:
int nextDigit = amount % 8;
The value of nextDigit in the Locals window changes to 5. This is the remainder after dividing 2693 by 8. 12. Click Step Into. The debugger runs the statement:
int digitCode = 0 + nextDigit;
The value of digitCode in the Locals window changes to 53. This is the character code of 5 (48 + 5).
Copyright © OnBarcode.com . All rights reserved.