b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

datagridview重叠_datagridview绑定list_datagridview右键菜单(57)

电脑杂谈  发布时间:2017-05-30 08:07:57  来源:网络整理

The below example uses the Northwind database to display related data from the Territory and Region tables (a territory is in a specific region.) Using the category and subcategory concept, the Region is the category and the Territory is the subcategory.

private void Form1_Load(object sender, EventArgs e)

{

this.territoriesTableAdapter.Fill(this.northwindDataSet.Territories);

this.regionTableAdapter.Fill(this.northwindDataSet.Region);

// Setup BindingSource for filtered view.

filteredTerritoriesBS = new BindingSource();

DataView dv = new DataView(northwindDataSet.Tables["Territories"]);

filteredTerritoriesBS.DataSource = dv;

}

private void dataGridView1_CellBeginEdit(object sender,

DataGridViewCellCancelEventArgs e)

{

if (e.ColumnIndex == territoryComboBoxColumn.Index)

{

// Set the combobox cell datasource to the filtered BindingSource

DataGridViewComboBoxCell dgcb = (DataGridViewComboBoxCell)dataGridView1

[e.ColumnIndex, e.RowIndex];

dgcb.DataSource = filteredTerritoriesBS;

// Filter the BindingSource based upon the region selected

this.filteredTerritoriesBS.Filter = "RegionID = "

this.dataGridView1[e.ColumnIndex - 1, e.RowIndex].Value.ToString();

}

}

private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)

{

if (e.ColumnIndex == this.territoryComboBoxColumn.Index)

{

// Reset combobox cell to the unfiltered BindingSource

DataGridViewComboBoxCell dgcb = (DataGridViewComboBoxCell)dataGridView1

[e.ColumnIndex, e.RowIndex];


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-50070-57.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...