예제 #1
0
        public province()
        {
            InitializeComponent();
            this.dataGridView1.AutoGenerateColumns = false;
            this.dataGridView1.DataSource          = ProvinceList;

            //ProvinceEntry test = new ProvinceEntry();
            //test.provinceName = "广东";
            //test.days = 2;
            //this.ProvinceList.Add(test);
            //ProvinceEntry test1 = new ProvinceEntry();
            //test1.provinceName = "广西";
            //test1.days = 3;
            //this.ProvinceList.Add(test1);
            //this.dataGridView1.bind
            //ProvinceList = new BindingList<ProvinceEntry>();
            string command = string.Empty;

            command = "select * from ProvinceSet ";
            DataTable dt = conn.GetDataTableBySql(command);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ProvinceEntry entry = new ProvinceEntry();
                    entry.provinceName = dt.Rows[i]["province"].ToString();
                    entry.days         = int.Parse(dt.Rows[i]["days"].ToString());
                    this.ProvinceList.Add(entry);
                }
            }
        }
예제 #2
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            ProvinceEntry entry = new ProvinceEntry();

            this.ProvinceList.Add(entry);
        }