CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2009
    Posts
    596

    Web Developer 2012 Express Problem

    Hello everyone,

    I'm having a hard time with some simple code. When I click a run code button I get two lines of Hello World tacked onto a textbox instead of one. I step through the code and see that the output function returns to the caller and gets called again for no apparent reason. I just installed Web Developer 2012 Express yesterday and am just messing around with it to get familiar with it. So after today's problems I installed Update 3 and it's still not working properly. Is the code faulty? Anyone have any advice to get this to work? I did this in C# and VB. In C# it works fine. The problem is only with the VB version. Here's the VB Code:
    Code:
    Partial Class _Default
        Inherits System.Web.UI.Page
    
        Protected Sub btnRun_Click(sender As Object, e As EventArgs) Handles btnRun.Click
            output("Hello World")
        End Sub
    
        Protected Sub output(value As String)
            txtOutput.Text += value + Environment.NewLine
        End Sub
    
        Protected Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
            txtOutput.Text = ""
        End Sub
    End Class
    and here's the markup:
    Code:
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Programming in Viusal Basic</title>
    </head>
    <body>
        <h1>Programming in Visual Basic</h1>
        <form id="form1" runat="server">
        <div>
            <asp:Panel ID="Panel1" runat="server">
                <asp:TextBox ID="txtOutput" runat="server" Height="175px" TextMode="MultiLine" Width="400px"></asp:TextBox>
            </asp:Panel>
            <asp:Panel ID="Panel2" runat="server">
                <asp:Button ID="btnRun" runat="server" Text="Run Code" Width="95px" OnClick="btnRun_Click" />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnClear" runat="server" Text="Clear Console" Width="107px" OnClick="btnClear_Click" />
            </asp:Panel>
        </div>
        </form>
    </body>
    </html>

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Web Developer 2012 Express Problem

    At first glance everything looks right, however your code is calling it twice....

    First here...
    Code:
        Protected Sub btnRun_Click(sender As Object, e As EventArgs) Handles btnRun.Click
            output("Hello World")
        End Sub
    and then again here...
    Code:
                <asp:Button ID="btnRun" runat="server" Text="Run Code" Width="95px" OnClick="btnRun_Click" />
    Remove either one of them, and it should call the sub only once.....
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Dec 2009
    Posts
    596

    Re: Web Developer 2012 Express Problem

    Thanks Grem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured