public static DataGridView getDGV(ref RegistryDataSet dataSource) { dgvBindingSource = new BindingSource(dataSource, "LineItem"); dgvBindingSource.Sort = "date, creditDebit DESC, amount"; typeColBindingSource = new BindingSource(dataSource.LineType, ""); typeColBindingSource.Sort = "name"; oppAccountColBindingSource = new BindingSource(dataSource.Account, ""); oppAccountColBindingSource.Sort = "name"; envelopeColBindingSource = new BindingSource(dataSource.Envelope, ""); envelopeColBindingSource.Sort = "name"; buildTheColumns(); // Line Item DGV dgv = new DataGridView(); dgv.Name = "theDataGridView"; dgv.DataSource = dgvBindingSource; dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; dgv.AlternatingRowsDefaultCellStyle = new MyCellStyleAlternatingRow(); dgv.SelectionMode = DataGridViewSelectionMode.CellSelect; dgv.Dock = DockStyle.Fill; dgv.AutoGenerateColumns = false; dgv.AllowUserToOrderColumns = false; dgv.AllowUserToDeleteRows = false; dgv.AllowUserToResizeRows = false; dgv.AllowUserToAddRows = false; // Turned on else where dgv.RowHeadersVisible = false; dgv.ShowCellErrors = false; dgv.ShowRowErrors = false; dgv.MultiSelect = false; dgv.Columns.AddRange( new DataGridViewColumn[] { dateCol, transactionIDCol, idCol, lineTypeCol, oppAccountIDCol, descriptionCol, confirmationNumCol, envelopeIDCol, creditAmountCol, completeCol, debitAmountCol, balanceAmountCol } ); return(dgv); }
//////////////////////////////////////////////////////////////////////////////////////////// // Functions Public //////////////////////////////////////////////////////////////////////////////////////////// public MultiDataGridView() { this.inRowValidating = false; this.regDataSet = new RegistryDataSet(); this.regDataSet.myInit(); this.regDataSet.ErrorsFound += new EventHandler(regDataSet_ErrorsFound); //////////////////////////////////// // The DataGridViews this.liDGV = LineItem.getDGV(ref this.regDataSet); this.envDGV = EnvLine.getDGV(ref this.regDataSet); this.liDGV.DataError += new DataGridViewDataErrorEventHandler(dgv_DataError); this.liDGV.CellFormatting += new DataGridViewCellFormattingEventHandler(dgv_CellFormatting); this.liDGV.CellDoubleClick += new DataGridViewCellEventHandler(dgv_CellDoubleClick); this.liDGV.CellValueChanged += new DataGridViewCellEventHandler(liDGV_CellValueChanged); this.liDGV.RowPrePaint += new DataGridViewRowPrePaintEventHandler(liDGV_RowPrePaint); this.liDGV.RowValidating += new DataGridViewCellCancelEventHandler(liDGV_RowValidating); this.liDGV.RowValidated += new DataGridViewCellEventHandler(liDGV_RowValidated); this.envDGV.DataError += new DataGridViewDataErrorEventHandler(dgv_DataError); this.envDGV.CellFormatting += new DataGridViewCellFormattingEventHandler(dgv_CellFormatting); this.envDGV.CellDoubleClick += new DataGridViewCellEventHandler(dgv_CellDoubleClick); this.envDGV.RowPrePaint += new DataGridViewRowPrePaintEventHandler(envDGV_RowPrePaint); //////////////////////////////////// // Panel Setup this.panel = new Panel(); this.panel.Controls.Add(this.liDGV); this.panel.Controls.Add(this.envDGV); this.panel.Dock = DockStyle.Fill; this.panel.ResumeLayout(); //////////////////////////////////// // Panel Setup this.buildTheContextMenues(); //////////////////////////////////// // Fill the tables this.reloadLineTypes(); this.reloadAccounts(); this.reloadEnvelopes(); //this.setEnvelopeAndAccount(SpclAccount.NULL, SpclEnvelope.NULL); }
public static DataGridView getDGV(ref RegistryDataSet dataSource) { dgvBindingSource = new BindingSource(dataSource, "EnvelopeLineView"); buildTheColumns(); // envDGV dgv = new DataGridView(); dgv.Name = "theDataGridView"; dgv.DataSource = dgvBindingSource; dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; dgv.AlternatingRowsDefaultCellStyle = new MyCellStyleAlternatingRow(); dgv.SelectionMode = DataGridViewSelectionMode.CellSelect; dgv.Dock = DockStyle.Fill; dgv.AutoGenerateColumns = false; dgv.AllowUserToOrderColumns = false; dgv.AllowUserToDeleteRows = false; dgv.AllowUserToResizeRows = false; dgv.AllowUserToAddRows = false; dgv.RowHeadersVisible = false; dgv.ShowCellErrors = false; dgv.ShowRowErrors = false; dgv.MultiSelect = false; dgv.ReadOnly = true; dgv.Columns.AddRange( new DataGridViewColumn[] { dateCol, transactionIDCol, lineItemIDCol, idCol, lineTypeCol, sourceCol, destinationCol, lineDescriptionCol, descriptionCol, creditAmountCol, completeCol, debitAmountCol, balanceAmountCol } ); return(dgv); }