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

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

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

splitContainer1.Panel1.Controls.Add(masterDataGridView);

splitContainer1.Panel2.Controls.Add(detaiataGridView);

this.Controls.Add(splitContainer1);

this.Load = new System.EventHandler(Form1_Load);

this.Text = "DataGridView master/detail demo";

}

private void Form1_Load(object sender, System.EventArgs e)

{

// Bind the DataGridView controls to the BindingSource

// components and load the data from the database.

masterDataGridView.DataSource = masterBindingSource;

detaiataGridView.DataSource = detailsBindingSource;

GetData();

// Resize the master DataGridView columns to fit the newly loaded data.

masterDataGridView.AutoResizeColumns();

// Configure the details DataGridView so that its columns automatically

// adjust their widths when the data changes.

detaiataGridView.AutoSizeColumnsMode =

DataGridViewAutoSizeColumnsMode.AllCells;

}

private void GetData()

{

try

{

// Specify a connection string. Replace the given value with a

// valid connection string for a Northwind SQL Server sample

// database accessible to your system.

String connectionString =

"Integrated Security=SSPI;Persist Security Info=False;"

"Initial Catalog=Northwind;Data Source=localhost";

SqlConnection connection = new SqlConnection(connectionString);

// Create a DataSet.

DataSet data = new DataSet();

data.Locale = System.Globalization.CultureInfo.InvariantCulture;

// Add data from the Customers table to the DataSet.

SqlDataAdapter masterDataAdapter = new


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

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

    每日福利
    热点图片
    拼命载入中...