Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DTable = new DataTable();
- SBind = new BindingSource();
- //ServersTable - DataGridView
- for (int i = 0; i < ServersTable.ColumnCount; ++i)
- {
- DTable.Columns.Add(new DataColumn(ServersTable.Columns[i].Name));
- }
- for (int i = 0; i < Apps.Count; ++i)
- {
- DataRow r = DTable.NewRow();
- r.BeginEdit();
- foreach (DataColumn c in DTable.Columns)
- {
- r[c.ColumnName] = //writing values
- }
- r.EndEdit();
- DTable.Rows.Add(r);
- }
- SBind.DataSource = DTable;
- ServersTable.DataSource = SBind;
- ServersTable.Columns.Clear();
- ServersTable.DataSource = SBind;
- for (int i = 0; i < ServersTable.ColumnCount; ++i) {
- DTable.Columns.Add(new DataColumn(ServersTable.Columns[i].Name));
- ServersTable.Columns[i].DataPropertyName = ServersTable.Columns[i].Name;
- }
- DataTable DTable = new DataTable();
- BindingSource SBind = new BindingSource();
- SBind.DataSource = DTable;
- DataGridView ServersTable = new DataGridView();
- ServersTable.AutoGenerateColumns = false;
- ServersTable.DataSource = DTable;
- ServersTable.DataSource = SBind;
- ServersTable.Refresh();
- foreach (DictionaryEntry entry in Hashtable)
- {
- datagridviewTZ.Rows.Add(entry.Key.ToString(), entry.Value.ToString());
- }
- BindingSource SBind = new BindingSource();
- SBind.DataSource = dtSourceData;
- ADGView1.AutoGenerateColumns = true; //must be "true" here
- ADGView1.DataSource = dtSourceData;
- ADGView1.Columns.Clear();
- ADGView1.DataSource = SBind;
- //set DGV's column names and headings from the Datatable properties
- for (int i = 0; i < ADGView1.Columns.Count; i++)
- {
- ADGView1.Columns[i].DataPropertyName = dtSourceData.Columns[i].ColumnName;
- ADGView1.Columns[i].HeaderText = dtSourceData.Columns[i].Caption;
- }
- ADGView1.Enabled = true;
- ADGView1.Refresh();
Add Comment
Please, Sign In to add comment