textBox1.DataBindings.Add("Text", collection, "path within collection");
Here, Text is the name of the property
of the control being bound.
Notice the pattern of the last two arguments:
collection is an object,
and the path is a string describing
something within that collection.
This pattern will recur.
hScrollBar1.Maximum = Count + hScrollBar1.LargeChange - 2;
this.BindingContext[boundListObject].Position++;
((CurrencyManager)this.BindingContext[boundListObject]).Position++;
(Yes, the name "CurrencyManager" is unfortunate.
But the word "concurrency" is already used for
something else.)
The point is that you get exactly one
CurrencyManager object for the
collection, no matter how many items from that collection
you display.
This allows you to synchronize the various items you display.
(But some container objects may have separate
BindingContext objects.)
dataGrid1.DataSource = dataSet1;
That's all there is to it, although it might look a little better if you add
dataGrid1.DataMember = dataSet1.Tables["Customers"];
because then this table will come up on the DataGrid automatically.
SQL Server / Machine / Northwind / Tables / < specific table >
you can see the data and the design of the table by right-clicking on
the table and choosing one.
sqlDataAdapater1.Fill(dataSet, "Table");
dataview.Sort = "SomeColumnName";or you can filter rows:
dataview.RowFilter = "ColumnName = 'value'"; //Note the single quotesYou then bind the resulting DataView to a DataGrid by using the grid's DataSource property. Incidentally, Kalani has some examples (exercise 5.2, starting on page 407, and exercise 5.5, starting on page 415) that use DataView.RowFilter to select rows to display from a detail table. My sample code, available here, does this using a DataRelation instead. A DataRelation is set up in a DataSet to relate two tables using their columns which contain matching keys.