private void moveCurrent(DataGridViewRow viewRow, NetworkSet networkSet, int trainingLayer) { DataRow row = (viewRow.DataBoundItem as DataRowView).Row; if (row != null) { row[NetworkDatabase.ColumnRoleId] = networkSet; row[NetworkDatabase.ColumnTrainingLayerId] = trainingLayer; } }
protected void SetUp(NetworkSet networkSet, string displayName) { this.m_networkSet = networkSet; this.TabPageName = displayName; this.lbSetTitle.Text = displayName; this.UpdateTitle(); this.dataGridView.AutoGenerateColumns = false; this.dataGridView.DataSource = this.BindingSource; this.dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; this.dataGridView.SelectionChanged += new EventHandler(dataGridView_SelectionChanged); this.dataGridView.Rows.CollectionChanged += new CollectionChangeEventHandler(dataGridView_CollectionChanged); }
private void moveSelections(NetworkSet networkSet, int trainingLayer) { if (this.dataGridView.SelectedRows.Count == 0) { this.moveCurrent(this.dataGridView.CurrentRow, networkSet, trainingLayer); } else { foreach (DataGridViewRow viewRow in this.dataGridView.SelectedRows) { this.moveCurrent(viewRow, networkSet, trainingLayer); } } this.BindingSource.ResetBindings(false); }
private void copyCurrent(DataGridViewRow viewRow, NetworkSet networkSet) { DataRow row = (viewRow.DataBoundItem as DataRowView).Row; if (row != null) { DataRow newRow = row.Table.NewRow(); foreach (DataColumn col in row.Table.Columns) { newRow[col] = row[col]; } newRow[NetworkDatabase.ColumnRoleId] = (ushort)networkSet; row.Table.Rows.Add(newRow); } }
//---------------------------------------- #region Private Methods private void copySelections(NetworkSet networkSet) { if (this.dataGridView.SelectedRows.Count == 0) { this.copyCurrent(this.dataGridView.CurrentRow, networkSet); } else { foreach (DataGridViewRow viewRow in this.dataGridView.SelectedRows) { this.copyCurrent(viewRow, networkSet); } } this.BindingSource.ResetBindings(false); }
private void copySelections(NetworkSet networkSet) { if (this.dataGridView.SelectedRows.Count == 0) { this.copyCurrent(this.dataGridView.CurrentRow, networkSet); } else { foreach (DataGridViewRow viewRow in this.dataGridView.SelectedRows) { this.copyCurrent(viewRow, networkSet); } } this.BindingSource.ResetBindings(false); }