日期:2014-05-19  浏览次数:20865 次

参数格式问题!急
代码
using   System;
using   System.Collections.Generic;
using   System.ComponentModel;
using   System.Data;
using   System.Drawing;
using   System.Text;
using   System.Windows.Forms;

namespace   WindowsApplication1
{
        public   struct   student
        {
                public   int   num;
                public   string   name;
                public   int   yuwen;
        };
        public   partial   class   Form1   :   Form
        {
                public   Form1()
                {
                        InitializeComponent();
                }

             
                public   static   student[]   S   =   new   student[20];
     
                private   void   Form1_Load(object   sender,   EventArgs   e)
                {

                }

                private   void   button1_Click(object   sender,   EventArgs   e)
                {
                        Form2   aaa   =   new   Form2(student   []   S);     //这里的格式应该怎么写?
                        aaa.Show();
                }

                private   void   textBox1_TextChanged(object   sender,   EventArgs   e)
                {

                }

        }
}
就是这里
Form2   aaa   =   new   Form2(student   []   S);     里面参数应该怎么写?

------解决方案--------------------
Form2 的
public Form2(student [] S)
{
InitializeComponent();
}
这么写
student[] stu = new student[x];
Form2 aaa = new Form2(Stu);
------解决方案--------------------
Form2 aaa = new Form2(student [] S); //这里的格式应该怎么写?
================================================================

Form2 aaa = new Form2();
aaa.S = this.S;
aaa.Show();

你的Form2也应该有student的结构,比如
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public student[] S;
}

如果要直接传参,那就要写成
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public Form2(student[] S)
{
In