Hello!
Here I display all the existing rows in the products table in the database
using the TableAdapter fill method to put these
rows into the DataTable object.
private void quryButton_Clic k(object sender, EventArgs e)
{
NorthwindDataSe tTableAdapters. ProductsTableAd apter productsTA =
new NorthwindDataSe tTableAdapters. ProductsTableAd apter();
productsTA.Fill (northwindDataS et.Products);
BindingSource productBS = new BindingSource(n orthwindDataSet ,
"Products") ;
this.productsGr id.DataSource = productBS;
}
If I instead click on the DataGridView and select the DataSource property
and there select
Other Data Sources and then Project Data Sources and then NorthwindDataSe t
and finally Product.
I get the same result except that the rows are displayed automatically whan
the program starts.
If I know look at the generated code and compare that code with the code in
method query_Button_Cl ick there are one row that differ.
In the generated code this row productBS = new
BindingSource(n orthwindDataSet , "Products") ;
has been replaced with this row productsBinding Source = new
BindingSource(t his.components) ;
Now to my question is this row "new BindingSource(n orthwindDataSet ,
"Products") ;" equivalent to
this row "new BindingSource(t his.components) ;
Why will the generated code for BindingSource differ with the one that I
create ?
//Tony
Here I display all the existing rows in the products table in the database
using the TableAdapter fill method to put these
rows into the DataTable object.
private void quryButton_Clic k(object sender, EventArgs e)
{
NorthwindDataSe tTableAdapters. ProductsTableAd apter productsTA =
new NorthwindDataSe tTableAdapters. ProductsTableAd apter();
productsTA.Fill (northwindDataS et.Products);
BindingSource productBS = new BindingSource(n orthwindDataSet ,
"Products") ;
this.productsGr id.DataSource = productBS;
}
If I instead click on the DataGridView and select the DataSource property
and there select
Other Data Sources and then Project Data Sources and then NorthwindDataSe t
and finally Product.
I get the same result except that the rows are displayed automatically whan
the program starts.
If I know look at the generated code and compare that code with the code in
method query_Button_Cl ick there are one row that differ.
In the generated code this row productBS = new
BindingSource(n orthwindDataSet , "Products") ;
has been replaced with this row productsBinding Source = new
BindingSource(t his.components) ;
Now to my question is this row "new BindingSource(n orthwindDataSet ,
"Products") ;" equivalent to
this row "new BindingSource(t his.components) ;
Why will the generated code for BindingSource differ with the one that I
create ?
//Tony