今天由小编为大家讲解有关语言编程的文章,相信对大家一定有很大的帮助 |
c语言编程入门首先在.Net创建两个WebForm页,分别命名为Default1,Default2。下面给出代码清单:
//Default1.aspx
<%@ Page Language=”C#” Debug=”true” AutoEventWireup=”true” CodeFile=”Default1.aspx.cs” Inherits=”Default1″ %>
无标题页
//Default2.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2: System.Web.UI.Page
{
C语言教程 private static int counter = 1;
protected void Page_Load(object sender, EventArgs e)
{
String res = “”;
String task = this.Request.Params[“task”];
String message = “”;
if (!string.IsNullOrEmpty(task))
{
if (task.Equals(“reset”))
{
counter = 1;
}
else
{
switch (counter)
{
case 1: message = “Steve walks on stage”; break;
case 2: message = “iPods rock”; break;
case 3: message = “Steve says Macs rule”; break;
case 4: message = “Change is coming”; break;
case 5: message = “Yes, OS X runs on Intel – has for years”; break;
case 6: message = “Macs will soon have Intel chips”; break;
case 7: message = “done”; break;
}
counter++;
}
res = “” + message + “”;
Response.ContentType = “text/Xml”;
Response.AppendHeader(“Cache-Control”, “no-cache”);
Response.Write(“”);
Response.Write(res);
Response.Write(“”);
Response.End();
}
}
}
文章很精彩,是否还想了解更多关于视频教程的文章,课课家官网是一个知识的海洋 |