C# Winform/程序以及如何将数组中的类1、类2、类3、类4写入linklabels?

C# Winform/程序以及如何将数组中的类1、类2、类3、类4写入linklabels?,c#,winforms,arrays,linklabel,C#,Winforms,Arrays,Linklabel,所以我的程序是这样工作的:使用winforms,用户输入ID号,使用数组,基于正确的ID号,学生信息和课程表输出到消息框中 我的问题是如何将消息框/数组中的4个类写入表单2中的linklabel文本 My Getschedule类包含数组,如下所示: 名称空间鹰眼类查找器 { } 我的表格2包含链接标签,如下所示: 公共类YOURCLASSSCHEDULE:System.Windows.Forms.Form { public System.Windows.Forms.LinkLabel link

所以我的程序是这样工作的:使用winforms,用户输入ID号,使用数组,基于正确的ID号,学生信息和课程表输出到消息框中

我的问题是如何将消息框/数组中的4个类写入表单2中的linklabel文本

My Getschedule类包含数组,如下所示:

名称空间鹰眼类查找器 {

}

我的表格2包含链接标签,如下所示:

公共类YOURCLASSSCHEDULE:System.Windows.Forms.Form { public System.Windows.Forms.LinkLabel linkLabel1; public System.Windows.Forms.LinkLabel linkLabel2; public System.Windows.Forms.LinkLabel linkLabel3; public System.Windows.Forms.LinkLabel linkLabel4; 私人按钮1

    /// Required designer variable.

    public System.ComponentModel.Container components = null;

    public YOURCLASSSCHEDULE()
    {

        //
        InitializeComponent();

        // TODO: Add any constructor code after InitializeComponent call

    }

    /// Clean up any resources being used.
    protected override void Dispose(bool disposing)
    {
        if (disposing)
        {
            if (components != null)
            {
                components.Dispose();
            }
        }
        base.Dispose(disposing);
    }

    #region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(YOURCLASSSCHEDULE));
        this.linkLabel1 = new System.Windows.Forms.LinkLabel();
        this.linkLabel2 = new System.Windows.Forms.LinkLabel();
        this.linkLabel3 = new System.Windows.Forms.LinkLabel();
        this.linkLabel4 = new System.Windows.Forms.LinkLabel();
        this.button1 = new System.Windows.Forms.Button();
        this.SuspendLayout();
        // 
        // linkLabel1
        // 
        this.linkLabel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
        this.linkLabel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.linkLabel1.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.linkLabel1.LinkArea = new System.Windows.Forms.LinkArea(0, 7);
        this.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
        this.linkLabel1.Location = new System.Drawing.Point(41, 123);
        this.linkLabel1.Name = "linkLabel1";
        this.linkLabel1.Size = new System.Drawing.Size(288, 32);
        this.linkLabel1.TabIndex = 1;
        this.linkLabel1.TabStop = true;
        this.linkLabel1.Text = "Class 1";
        this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
        // 
        // linkLabel2
        // 
        this.linkLabel2.BackColor = System.Drawing.SystemColors.ActiveCaption;
        this.linkLabel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.linkLabel2.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.linkLabel2.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
        this.linkLabel2.Location = new System.Drawing.Point(467, 123);
        this.linkLabel2.Name = "linkLabel2";
        this.linkLabel2.Size = new System.Drawing.Size(288, 32);
        this.linkLabel2.TabIndex = 2;
        this.linkLabel2.TabStop = true;
        this.linkLabel2.Text = "Class 2";
        this.linkLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        this.linkLabel2.VisitedLinkColor = System.Drawing.Color.Navy;
        this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
        // 
        // linkLabel3
        // 
        this.linkLabel3.BackColor = System.Drawing.SystemColors.ActiveCaption;
        this.linkLabel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.linkLabel3.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.linkLabel3.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
        this.linkLabel3.Location = new System.Drawing.Point(41, 311);
        this.linkLabel3.Name = "linkLabel3";
        this.linkLabel3.Size = new System.Drawing.Size(288, 32);
        this.linkLabel3.TabIndex = 3;
        this.linkLabel3.TabStop = true;
        this.linkLabel3.Text = "Class 3";
        this.linkLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked);
        // 
        // linkLabel4
        // 
        this.linkLabel4.BackColor = System.Drawing.SystemColors.ActiveCaption;
        this.linkLabel4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.linkLabel4.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.linkLabel4.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
        this.linkLabel4.Location = new System.Drawing.Point(467, 311);
        this.linkLabel4.Name = "linkLabel4";
        this.linkLabel4.Size = new System.Drawing.Size(288, 32);
        this.linkLabel4.TabIndex = 4;
        this.linkLabel4.TabStop = true;
        this.linkLabel4.Text = "Class 4";
        this.linkLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked);
        // 

        // 
        this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
        this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
        this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
        this.ClientSize = new System.Drawing.Size(790, 482);
        this.Controls.Add(this.button1);
        this.Controls.Add(this.linkLabel4);
        this.Controls.Add(this.linkLabel3);
        this.Controls.Add(this.linkLabel2);
        this.Controls.Add(this.linkLabel1);
        this.Font = new System.Drawing.Font("OldDreadfulNo7 BT", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.Name = "YOURCLASSSCHEDULE";
        this.Text = "Your Classes";
        this.Load += new System.EventHandler(this.Form2_Load);
        this.ResumeLayout(false);

    }
    #endregion

    public void Form2_Load(object sender, System.EventArgs e)
    {
       // if (text == "900456317")
       // {

        //}

    }

    public void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
    {

        System.Diagnostics.Process.Start("http://www.georgiasouthern.edu/map/");
    }

    private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {

    }

    private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {

    }

    private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
        Form1 form1 = new Form1();
        form1.Show();
        this.Hide();
    }
}
///必需的设计器变量。
public System.ComponentModel.Container components=null;
公共课程表()
{
//
初始化组件();
//TODO:在InitializeComponent调用后添加任何构造函数代码
}
///清理所有正在使用的资源。
受保护的覆盖无效处置(布尔处置)
{
如果(处置)
{
if(组件!=null)
{
组件。Dispose();
}
}
基地。处置(处置);
}
#区域Windows窗体设计器生成的代码
/// 
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
/// 
私有void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager资源=新的System.ComponentModel.ComponentResourceManager(typeof(YOURCLASSSCHEDULE));
this.linkLabel1=new System.Windows.Forms.LinkLabel();
this.linkLabel2=new System.Windows.Forms.LinkLabel();
this.linkLabel3=new System.Windows.Forms.LinkLabel();
this.linkLabel4=new System.Windows.Forms.LinkLabel();
this.button1=new System.Windows.Forms.Button();
这个.SuspendLayout();
// 
//链接标签1
// 
this.linkLabel1.BackColor=System.Drawing.SystemColors.ActiveCaption;
this.linkLabel1.BorderStyle=System.Windows.Forms.BorderStyle.Fixed3D;
this.linkLabel1.Font=new System.Drawing.Font(“Times new Roman”,14.25F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((字节)(0));
this.linkLabel1.LinkArea=新系统.Windows.Forms.LinkArea(0,7);
this.linkLabel1.LinkBehavior=System.Windows.Forms.LinkBehavior.HoverUnderline;
this.linkLabel1.Location=新系统图点(41123);
this.linkLabel1.Name=“linkLabel1”;
this.linkLabel1.Size=新系统.图纸.尺寸(288,32);
this.linkLabel1.TabIndex=1;
this.linkLabel1.TabStop=true;
this.linkLabel1.Text=“Class 1”;
this.linkLabel1.TextAlign=System.Drawing.ContentAlignment.MiddleCenter;
this.linkLabel1.LinkClicked+=新系统.Windows.Forms.linklabelinkclickedEventHandler(this.linkLabel1\u LinkClicked);
// 
//链接标签2
// 
this.linkLabel2.BackColor=System.Drawing.SystemColors.ActiveCaption;
this.linkLabel2.BorderStyle=System.Windows.Forms.BorderStyle.Fixed3D;
this.linkLabel2.Font=new System.Drawing.Font(“Times new Roman”,14.25F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((字节)(0));
this.linkLabel2.LinkBehavior=System.Windows.Forms.LinkBehavior.HoverUnderline;
this.linkLabel2.Location=新系统图点(467123);
this.linkLabel2.Name=“linkLabel2”;
this.linkLabel2.Size=新系统.图纸.尺寸(288,32);
this.linkLabel2.TabIndex=2;
this.linkLabel2.TabStop=true;
this.linkLabel2.Text=“Class 2”;
this.linkLabel2.TextAlign=System.Drawing.ContentAlignment.MiddleCenter;
this.linkLabel2.VisitedLinkColor=System.Drawing.Color.Navy;
this.linkLabel2.LinkClicked+=新系统.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2\u LinkClicked);
// 
//链接标签3
// 
this.linkLabel3.BackColor=System.Drawing.SystemColors.ActiveCaption;
this.linkLabel3.BorderStyle=System.Windows.Forms.BorderStyle.Fixed3D;
this.linkLabel3.Font=new System.Drawing.Font(“Times new Roman”,14.25F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((字节)(0));
this.linkLabel3.LinkBehavior=System.Windows.Forms.LinkBehavior.HoverUnderline;
this.linkLabel3.Location=新系统图点(41311);
this.linkLabel3.Name=“linkLabel3”;
this.linkLabel3.Size=新系统图纸尺寸(288,32);
this.linkLabel3.TabIndex=3;
this.linkLabel3.TabStop=true;
this.linkLabel3.Text=“Class 3”;
this.linkLabel3.TextAlign=System.Drawing.ContentAlignment.MiddleCenter;
this.linkLabel3.LinkClicked+=新系统.Windows.Forms.linklabelinkclickedEventHandler(this.linkLabel3\u LinkClicked);
// 
//链接标签4
// 
this.linkLabel4.BackColor=System.Drawing.SystemColors.ActiveCaption;
this.linkLabel4.BorderStyle=System.Windows.Forms.BorderStyle.Fixed3D;
this.linkLabel4.Font=new System.Drawing.Font(“Times new Roman”,14.25F,System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,((字节)(0));
this.linkLabel4.LinkBehavior=System.Windows.Forms.LinkBehavior.HoverUnderline;
this.linkLabel4.Location=新系统图纸点(467311);
this.linkLabel4.Name=“linkLabel4”;
this.linkLabel4.Size=新系统图纸尺寸(288,32);
this.linkLabel4.TabIndex=4;
this.linkLabel4.TabStop=true;
this.linkLabel4.Text=
    /// Required designer variable.

    public System.ComponentModel.Container components = null;

    public YOURCLASSSCHEDULE()
    {

        //
        InitializeComponent();

        // TODO: Add any constructor code after InitializeComponent call

    }

    /// Clean up any resources being used.
    protected override void Dispose(bool disposing)
    {
        if (disposing)
        {
            if (components != null)
            {
                components.Dispose();
            }
        }
        base.Dispose(disposing);
    }

    #region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(YOURCLASSSCHEDULE));
        this.linkLabel1 = new System.Windows.Forms.LinkLabel();
        this.linkLabel2 = new System.Windows.Forms.LinkLabel();
        this.linkLabel3 = new System.Windows.Forms.LinkLabel();
        this.linkLabel4 = new System.Windows.Forms.LinkLabel();
        this.button1 = new System.Windows.Forms.Button();
        this.SuspendLayout();
        // 
        // linkLabel1
        // 
        this.linkLabel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
        this.linkLabel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.linkLabel1.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.linkLabel1.LinkArea = new System.Windows.Forms.LinkArea(0, 7);
        this.linkLabel1.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
        this.linkLabel1.Location = new System.Drawing.Point(41, 123);
        this.linkLabel1.Name = "linkLabel1";
        this.linkLabel1.Size = new System.Drawing.Size(288, 32);
        this.linkLabel1.TabIndex = 1;
        this.linkLabel1.TabStop = true;
        this.linkLabel1.Text = "Class 1";
        this.linkLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
        // 
        // linkLabel2
        // 
        this.linkLabel2.BackColor = System.Drawing.SystemColors.ActiveCaption;
        this.linkLabel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.linkLabel2.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.linkLabel2.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
        this.linkLabel2.Location = new System.Drawing.Point(467, 123);
        this.linkLabel2.Name = "linkLabel2";
        this.linkLabel2.Size = new System.Drawing.Size(288, 32);
        this.linkLabel2.TabIndex = 2;
        this.linkLabel2.TabStop = true;
        this.linkLabel2.Text = "Class 2";
        this.linkLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        this.linkLabel2.VisitedLinkColor = System.Drawing.Color.Navy;
        this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
        // 
        // linkLabel3
        // 
        this.linkLabel3.BackColor = System.Drawing.SystemColors.ActiveCaption;
        this.linkLabel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.linkLabel3.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.linkLabel3.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
        this.linkLabel3.Location = new System.Drawing.Point(41, 311);
        this.linkLabel3.Name = "linkLabel3";
        this.linkLabel3.Size = new System.Drawing.Size(288, 32);
        this.linkLabel3.TabIndex = 3;
        this.linkLabel3.TabStop = true;
        this.linkLabel3.Text = "Class 3";
        this.linkLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked);
        // 
        // linkLabel4
        // 
        this.linkLabel4.BackColor = System.Drawing.SystemColors.ActiveCaption;
        this.linkLabel4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.linkLabel4.Font = new System.Drawing.Font("Times New Roman", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.linkLabel4.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
        this.linkLabel4.Location = new System.Drawing.Point(467, 311);
        this.linkLabel4.Name = "linkLabel4";
        this.linkLabel4.Size = new System.Drawing.Size(288, 32);
        this.linkLabel4.TabIndex = 4;
        this.linkLabel4.TabStop = true;
        this.linkLabel4.Text = "Class 4";
        this.linkLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked);
        // 

        // 
        this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
        this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
        this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
        this.ClientSize = new System.Drawing.Size(790, 482);
        this.Controls.Add(this.button1);
        this.Controls.Add(this.linkLabel4);
        this.Controls.Add(this.linkLabel3);
        this.Controls.Add(this.linkLabel2);
        this.Controls.Add(this.linkLabel1);
        this.Font = new System.Drawing.Font("OldDreadfulNo7 BT", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.Name = "YOURCLASSSCHEDULE";
        this.Text = "Your Classes";
        this.Load += new System.EventHandler(this.Form2_Load);
        this.ResumeLayout(false);

    }
    #endregion

    public void Form2_Load(object sender, System.EventArgs e)
    {
       // if (text == "900456317")
       // {

        //}

    }

    public void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
    {

        System.Diagnostics.Process.Start("http://www.georgiasouthern.edu/map/");
    }

    private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {

    }

    private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {

    }

    private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
        Form1 form1 = new Form1();
        form1.Show();
        this.Hide();
    }
}
YourBusinessLayer.ScheduleManager manager = new ScheduleManager();

ScheduleManager.Add(new Schedule("Name", "ID", "Class", "Timings"); //Add schedules
List<Schedule> listOfAllSchedules= manager.GetSchedules(); //Get Schedules

manager.Schedule[0].ID
manager.Schedule[0].Name
manager.Schedule[0].Class
//....