[心得] 網際網路程式設計(3/17)
(用在空白處:作下拉式清單)
if (Page.IsPostBack) return;
StreamReader sr = new StreamReader(Server.MapPath("學號_score.txt"), System.Text.Encoding.Default);
Label[] 變數1 = new Label[11];
DropDownList[] 變數2 = new DropDownList[題數];
變數1[0] = Label1;變數1[1] = Label2;變數1[2] = Label3;變數1[3] = Label4;變數1[4] = Label5;
變數1[5] = Label6; 變數1[6] = Label7; 變數1[7] = Label8; 變數1[8] = Label9; 變數1[9] = Label10;
變數1[10] = Label11;
變數2[0] = DropDownList1; 變數2[1] = DropDownList2; 變數2[2] = DropDownList3; 變數2[3] = DropDownList4; 變數2[4] = DropDownList5;
變數2[5] = DropDownList6; 變數2[6] = DropDownList7; 變數2[7] = DropDownList8; 變數2[8] = DropDownList9; 變數2[9] = DropDownList10;
變數2[10] = DropDownList11;
for (int i = 0; i < 11; i++){
String 變數(過程1) = sr.ReadLine();
String 變數(過程2) = sr.ReadLine();
String 變數(過程3) = sr.ReadLine();
String 變數(過程4) = sr.ReadLine();
String 變數(過程5) = sr.ReadLine();
變數1[i].Text = 變數(過程1);
變數2[i].Items.Clear();
變數2[i].Items.Add(變數(過程2));
變數2[i].Items.Add(變數(過程3));
變數2[i].Items.Add(變數(過程4));
變數2[i].Items.Add(變數(過程5));}
sr.Close();
(用在按鍵)
string 變數1 = this.TextBox1.Text;
string 變數2 = Request.ServerVariables["REMOTE_ADDR"];
Response.Write("來自"+變數2+"的"+變數1+",你的得分是:"+score.ToString());
Datetime 變數3 = DateTime.Now;
string 變數4 = 變數3.ToString();
StreamWriter 變數5 = new StreamWriter(Server.MapPath("學號_score.txt"), true);
string 變數6 =變數2+" " + 變數1 + " " + 自己設定的.ToString() + "分..." + 變數4;
變數5 .WriteLine(C);
變數5 .Close();
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.148.79
→
03/20 00:27, , 1F
03/20 00:27, 1F
→
03/20 00:35, , 2F
03/20 00:35, 2F
→
03/20 00:37, , 3F
03/20 00:37, 3F