当前位置:编程学习 > C#/ASP.NET >>

ASP.NET程序填空

Default.aspx中部分代码 <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title> asp.net程序设计基础</title> </head> <body> <form id="form1" runat="server"> <asp:TextBox ID="TextBox1" runat="server" Width="61px"></asp:TextBox> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>+</asp:ListItem> <asp:ListItem>-</asp:ListItem> <asp:ListItem>*</asp:ListItem> <asp:ListItem>/</asp:ListItem> </asp:DropDownList> <asp:TextBox ID="TextBox2" runat="server" Width="57px"></asp:TextBox> <asp:ButtonID="Button1" runat="server" onclick="Button1_Click" Text="计算" /> <br /> 计算结果:<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </div> </form> </body> </html> Default.aspx.cs部分代码 protected void Button1_Click(object sender, EventArgs e) { double A = (6) ; double B = (7) ; double (8) ; switch (DropDownList1.SelectedValue) { case "+": C = A + B; break; case "-": C = A - B; break; case "*": C = A * B; break; case "/": (9) ; break; } Label1.Text = (10) ; } } 该程序的最终运行效果如下图所示:
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,