Note in Visual Studio .NET

Maker Code 128B in Visual Studio .NET Note
Decode Code 128 Code Set C In .NET
Using Barcode Control SDK for .NET Control to generate, create, read, scan barcode image in .NET applications.
Let us look at a step-by-step approach to debug an ASP.NET Web page. Consider a simple Web page that provides users with the functionality of adding two numbers. The code of this Web page is given as follows: <%@ Page Language="vb"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE></TITLE> </HEAD> <Script runat="server"> Sub DoArithmetic(Src As Object, E As EventArgs) lblResult.Text = txtNum1.Text + txtNum2.Text End Sub </Script> <Body> <Form id="Form1" method="post" runat="server"> <P> <asp:Label id="lblNumber1" runat="server">Number 1</asp:Label> <asp:TextBox id="txtNum1" runat="server"></asp:TextBox> </P> <P> <asp:Label id="lblNumber2" runat="server">Number 2</asp:Label> <asp:TextBox id="txtNum2" runat="server"></asp:TextBox> </P> <P> <asp:Button id="cmdCalculate" runat="server" Text="Calculate" onclick="DoArithmetic" /> </P> <P>
Code 128 Code Set A Creation In .NET
Using Barcode encoder for Visual Studio .NET Control to generate, create Code 128 image in Visual Studio .NET applications.
<asp:Label id="lblResult" runat="server" Width="270px" Height="31px"></asp:Label> </P> </Form> </Body> </HTML> When you browse this Web page in Internet Explorer, and enter two numbers, say 5 and 5, in the two text boxes, and then click the Calculate button, you'll notice that the result that is displayed is 55 instead of 10. Let us see how you can use the Visual Studio .NET debugger to debug the preceding code. Before browsing the page in Internet Explorer, the first thing that you need to do is to set a breakpoint on the line from where debugging should start. Typically, the line on which the debugger should break will be the one that the developer suspects as a source of malfunctioning. In our case, the breakpoint should be on the Sub procedure named DoArithmetic. Note that a breakpoint can also be conditional; the debugger will break on the breakpoint only if a given condition evaluates to True or False as defined on the breakpoint. Figure 7-1 shows the New Breakpoint dialog box.
Code 128 Recognizer In VS .NET
Using Barcode recognizer for .NET framework Control to read, scan read, scan image in VS .NET applications.
Figure 7-1: The New Breakpoint dialog box Note You can also add a breakpoint by clicking the left margin of the line on which you need to set the breakpoint or by pressing the F9 key while the cursor is on the line. Then, to remove a breakpoint, press F9 or click the left margin of the line at which the breakpoint was set. To debug the current page, you need to mark the page as the startup page of the project. This can be done by right-clicking the ASPX file in the Solution Explorer window and choosing the Set As Start Page option from the context menu. After you have set the breakpoint and set the Web page as the startup page of the project, you can start debugging your page. To start debugging the page, select Start from the Debug menu. This will start a new instance of Internet Explorer, and load the current page in it. When you enter numbers in the Number1 and Number2 text boxes, say 5 and 5, respectively, and click the Calculate button, the debugger enters Break mode. In this
Painting Bar Code In .NET Framework
Using Barcode printer for VS .NET Control to generate, create bar code image in .NET applications.
mode, you can see the line at which you set the breakpoint being highlighted. You can check the values of the various variables and controls for correctness in Break mode. You'll now run through the procedure in a stepwise manner to identify the source of the problem. To do so, select Debug Step Into. You'll notice that the next line (this is the only code line in the procedure) gets highlighted. Select Debug Step Into once more to execute this line of code. At this stage, the next line (End Sub) gets highlighted. This is the time when you should check the value in each text box and thus conclude the source of the problem. The Immediate window can be used for ad-hoc querying of variable and control property values. You can open the Immediate window by selecting Debug Windows Immediate. In the Immediate window, type the following statement: lblResult.Text After typing the preceding statement, press Enter. The Immediate window displays "55." The Result "55" gives an indication that the result is a string and not a number. This is enough to identify that the problem was due to the datatype. The numbers entered in the two text boxes were set in the Text property of the text boxes. In the DoArithmetic procedure, when you added the two numbers by accessing the Text property of the text boxes, the "+" operator worked as the concatenation operator to concatenate two strings rather than adding two numbers. Therefore, the values entered in the text boxes must be converted to a numeric datatype before adding them. After you've found the actual error, you can stop debugging and correct the code. To stop the debugging process, select Debug Stop Debugging. Next, remove the breakpoint (Press F9 at the line at which the breakpoint was set). Modify the line in the DoArithmetic procedure to read: lblResult = Cint(txtNum1.Text) + Cint(txtNum2.Text) After you fix the code and run the application, you'll notice that now the page gives the correct output.
Recognize Bar Code In VS .NET
Using Barcode decoder for .NET Control to read, scan read, scan image in .NET framework applications.
Code 128A Encoder In C#.NET
Using Barcode generator for .NET Control to generate, create USS Code 128 image in VS .NET applications.
Encoding Code-128 In VB.NET
Using Barcode printer for .NET Control to generate, create Code 128 Code Set C image in .NET framework applications.
Making Code 39 In Visual Studio .NET
Using Barcode generator for VS .NET Control to generate, create Code 39 Extended image in Visual Studio .NET applications.
Make USD8 In .NET
Using Barcode generator for VS .NET Control to generate, create Code 11 image in VS .NET applications.
UPC-A Supplement 2 Printer In .NET Framework
Using Barcode generator for ASP.NET Control to generate, create UPC-A Supplement 2 image in ASP.NET applications.
ANSI/AIM Code 128 Creator In Visual Basic .NET
Using Barcode creator for .NET framework Control to generate, create Code 128 Code Set B image in VS .NET applications.
Print Code-39 In Java
Using Barcode encoder for Java Control to generate, create Code 3 of 9 image in Java applications.
Generate Bar Code In Java
Using Barcode encoder for Java Control to generate, create barcode image in Java applications.