private void SelectAccountcycleForm_Load(object sender, EventArgs e) { AccountcycleFactory af = new AccountcycleFactory(); this.accountcycleList = af.query(-6, 1); accountcycleDt = new DataTable(); DataColumn idCol = new DataColumn(); idCol.ColumnName = "id"; idCol.DataType = Type.GetType("System.String"); accountcycleDt.Columns.Add(idCol); accountcycleDt.Columns.Add("月份", Type.GetType("System.String")); foreach (Accountcycle item in this.accountcycleList) { DataRow datarow = accountcycleDt.NewRow(); datarow[0] = item.Id; datarow[1] = item.Name; accountcycleDt.Rows.Add(datarow); } this.AccountcycleDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; this.AccountcycleDataGridView.MultiSelect = false; this.AccountcycleDataGridView.ColumnHeadersHeight = 30; this.AccountcycleDataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; this.AccountcycleDataGridView.RowTemplate.Height = 20; this.AccountcycleDataGridView.EditMode = DataGridViewEditMode.EditProgrammatically; this.AccountcycleDataGridView.DataSource = accountcycleDt; this.AccountcycleDataGridView.Columns["id"].Visible = false; }
private void initAccountcycle() { AccountcycleFactory af = new AccountcycleFactory(); List <Accountcycle> accountcycleList = af.query(-1, -1); if (accountcycleList != null && accountcycleList.Count > 0) { this.accountcycle = accountcycleList[0]; this.accountcycleTextBox.Text = this.accountcycle.Name; } }
private void iniAccountcycle() { AccountcycleFactory af = new AccountcycleFactory(); //new月份工厂 List <Accountcycle> accountcycleList = af.query(-1, -1); //引用显示月份方法 if (accountcycleList != null && accountcycleList.Count > 0) { this.accountcycle = accountcycleList[0]; this.accountcycleTextBox.Text = this.accountcycle.Name;//月份显示栏显示月份 } }