2018年10月6日 星期六

TEXTBOX物件FOR迴圈運用

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        List<TextBox> tb = new List<TextBox>();
        TextBox tb0 = TextBox1;
        TextBox tb1 = TextBox2;
        TextBox tb2 = TextBox3;
        TextBox tb3 = TextBox4;
        tb.Add(tb0);
        tb.Add(tb1);
        tb.Add(tb2);
        tb.Add(tb3);
        for (int i = 0; i < 4; i++)
        {
            Literal1.Text += tb[i].Text+"<br />";
        }
    }
   
}

沒有留言:

張貼留言

WPF聊天室应用(ASP.NET Core SignalR)

  WPF聊天室应用(ASP.NET Core SignalR) https://www.bilibili.com/video/BV1Q741187Si?p=2 https://www.bilibili.com/video/BV1UV411e75T?from=search&...