下面这个是窗体的代码,
public partial class Grade : Form
    {
        public Grade()
        {
            InitializeComponent();
        }        //用来存放用户在数据库中对应的“Id”
        private int userId;
        public Grade(int userId)
        {
            this.userId = userId;
        }        //定义数据库连接语句
        SqlConnection con = new SqlConnection("server = localhost;DataBase=Peony_ERP;user Id=sa;password=sa");        private void Grade2_Load(object sender, EventArgs e)
        {
            //设置“员工”的数据源
            con.Open();
            //select表中“权限”大于“1”的用户,即“评分(2)”和“员工(3)”
            SqlCommand cmd = new SqlCommand("SELECT RealName FROM Users WHERE permission > 1 ", con);  //and Id != " + userId + "
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                this.cmbRealName.Items.Add(dr[0].ToString().Trim());
            }            //设置“月份”的数据源
            int[] months = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
            cmbMonth.DataSource = months;
        }
    }
下面是创建窗体的代码Application.Run(new Grade(logfrm.userId));  //只不过加了一个logfrm.userId,但是出来的窗体什么控件都没有之前没有这个logfrm.userId的时候,自己设计的空间都在上面