index [ptgmedia.pearsoncmg.com]€¦ · backgroundworker, 239 barchartcontrol adding editing...
TRANSCRIPT
671
Index
Symbols<%#...%> syntax, 508–509? (question mark), 140+ (plus sign), 202
AAbsolute positioning, controls, 589–590AcceptChanges method
client-side transactions, 650–651EndEdit method vs., 158setting row state in data tables, 641
accessDataSource control, 507Add Column dialog, 264–265, 276–277Add Connection dialog
adding new data sources and connections, 7–8
overview of, 182–183setting up typed data set connections,
45–46Add method
adding columns to TextBox cell, 223adding controls to Windows Forms, 552adding rows to grids, 224binding image columns to PictureBox, 142binding numeric columns to TextBox,
145–147IList interface, 300–301inserting items in BindingSource list,
124–126simple data binding, 91
Add Query Wizard, 75–77
add tag, connectionStrings, 58Add Web Reference dialog, 185–186AddBarChartControl method, 389–391AddControlToGrid method, 531AddCopies method
adding rows in virtual mode, 234initializing grid, 238working with unbound columns, 231
AddCustomers method, 425AddHandler keyword, 575AddIndex method, IBindingList, 312AddingNew event, 125–126, 131AddNew method
creating custom collection type, 427IBindingList, 312–313ICancelAddNew interface, 426using BindingSource as data storage
container, 124–126AddNewCore method, 427–428, 441AddValueChanged method, 307AddWithKey property, 622ADO.NET, 601–670
client-side transactions, 650–651creating data sets programmatically,
611–613data set and data adapter events, 651–654DataSet structure, 607–609handling concurrency, 628–631loading data into XPathDocument,
664–665loading data sets from database, 613–619loading data sets from files, 609–611
Noyes.book Page 671 Thursday, December 15, 2005 3:57 PM
INDEX672
ADO.NET, continuedloading DataTable with DataReader,
619–621master-details DataSets, 621–623merging data from multiple data sets,
639–641navigating XML document, 667–669overview of, 601–603querying XML data, 665–667reading data into business objects, 654–658relational data access, 603–607retrieving data with stored procedures,
623–624scoping transactions with
System.Transactions, 647–649searching data sets, 637–638updating database using data sets, 624–628updating with data sets and stored
procedures, 632–637working with data views, 641–642working with SmlDataDocument class,
659–663working with transactions, 643–646working withXPathDocument class,
663–664XML data access, 658–659
Aliases, 78–79AllCells value, DataGridViewAutoSize-
Mode, 260AllowEdit property, IBindingList, 133, 311, 313AllowNew property, IBindingList, 133, 311,
313AllowPaging property, DataGrid control, 511AllowRemove property, IBindingList, 133,
311, 313AllowUserToAddRows property, 221, 265AllowUserToDeleteRows property, 221, 265AllowUserToOrderColumns property,
266–269AlternatingRowsDefaultCellStyle property,
282Anchor property, controls, 590–592app.config, 58, 60Application class, defined, 572Application class, XAML, 538–539Application object, WinFx, 525ApplySort method
creating rich object collections, 426IBindingList, 312, 317–318
IBindingListView, 324, 444ApplySortCore method, 437ApplySortInternal method, 437Architecture, Windows Forms, 567–570ArgumentException, 611ASP.NET, 487–519
data binding expressions, 508–509data binding in ASP.NET 2.0, 498–499DetailsView control, 512–514FormView control, 514–515GridView control, 509–512hierarchical binding, 518master-details data binding, 515–518overview of, 487–488page processing basics, 489
ASP.NET 1.X, 490–498hooking up dynamic behavior in
code-behind class, 492–495overview of, 490–491presenting tabular data in grid, 491–492row selection in grid, 495–496using expressions, 496–498
ASP.NET data sources, 499–508AccessDataSource control, 507ObjectDataSource control, 505–507overview of, 499–500SiteMapDataSource control, 508SqlDataSource control, 500–505XmlDataSource control, 507–508
ASPX files, 489, 492–495Attributes
designer initialization of data binding, 359–360
specifying binding properties on controls, 360–362
XPathNavigator navigation methods, 669Authentication, 8–9AutoComplete feature
DataGridComboBoxColumn, 252filter grid controls, 354–355overview of, 160–162TextBox control, 371–375
AutoGenerateColumns property, 358Automatic formatting, 147–148AutoSizeMode property
DataGridView control, 259–261DataGridViewColumn, 246, 375–376
AutoValidate property, 461–462, 471–472Avalon code name, 521
Noyes.book Page 672 Thursday, December 15, 2005 3:57 PM
INDEX 673
BBackgroundWorker, 239BarChartControl
adding editing support to, 391–397creating, 381–383designing, 379–381rendering bars, 383–384
BarChartControl, coding, 384–391defining custom control skeleton, 385–386initializing and updating data bindings,
387–389overview of, 384–385using AddBarChartControl method,
389–391Batching, in database updates, 33BeginEdit method
binding controls to data sources, 157IEditableObject interface, 329transacted editing of objects, 417–420
BeginInit method, ISupportInitialize, 335–337
BeginTransaction method, table adapters, 64–65
Bind method, ASP.NET 2.0, 509BindFilterFields method, 368Binding object
binding DateTime column to DateTimePicker, 142–144
binding DateTime column to TextBox, 144–145
binding image column to PictureBox, 141–142overview of, 135–137simple data binding with, 83–84, 90–92
BindingComplete event, 131BindingContext, 20BindingContext property, 86, 96–97BindingEvents application. See Events,
bindingBindingList<T> class
creating rich object collections, 424–426defined, 287as generic collection class, 408managing transacted additions to
collections, 439–441object edit notifications, 423–424raised item changed events, 441–443
BindingList<T> class, custom collections, 426–439
adding search functionality, 430–431adding sorting capabilities, 432–439getting test data, 429–430overview of, 426–427taking over construction process, 427–428
BindingListView<T> classadding search functionality, 430–431adding sorting functionality, 435–437using IBindingListView functionality,
445–453BindingNavigator control
adding navigation to control with, 11defined, 151–152master-details data binding with, 105–106overview of, 103–104
BindingSource componentdata binding with, 97–99, 112–115, 219–220defined, 15events, 131–133generating data-bound controls, 11, 195–196implementing ITypedList with, 307–309master-details data binding with, 105–106,
116–121navigating data with, 121–122overview of, 111–112paging through data with, 99–104populating with data reader, 126–128position changes in, 365–366restricting changes to data with, 133sorting, searching, and filtering data with,
128–130WinFx binding vs., 532
BlinkRate properties, ErrorProvider, 466BlinkStyle properties, ErrorProvider, 466bool Contains method, IList, 300Borders, in DataGridView, 282–283Bound controls. See Data-bound controlsBuilt-in columns, DataGridView, 241–255
DataGridViewButtonColumn, 250DataGridViewCell properties, 242–246DataGridViewCheckBoxColumn, 251DataGridViewColumn properties, 246–249DataGridViewComboBoxColumn, 252–255DataGridViewImageColumn, 251–252DataGridViewLinkColumn, 250DataGridViewTextBoxColumn, 249–250overview of, 241–242
Business logic layer, 21–27, 459
Noyes.book Page 673 Thursday, December 15, 2005 3:57 PM
INDEX674
Business objects, 399–456adding IBindingListView to, 443–453CustomBusinessObjects example. See
CustomBusinessObjects exampledefining and working with, 400–405defining and working with collections,
405–406edit notifications with
INotifyPropertyChanged, 423–424edit notifications with property change
events, 420–423generic collection classes, 406–408managing transacted additions to
collections, 439–441overview of, 399–400raising item changed events, 441–443reading data into, 654–658setting textual data-binding behavior of,
415–416through Data Sources window, 453–455transacted object editing and, 416–420using BindingList<T>. See BindingList<T>
classusing IDataErrorInfo, 479–482
Button controladding to Windows Forms, 550–552adding to WinFx applications, 530–531overview of, 580using DataGridViewButtonColumn, 250
ButtonColumn, 495–496Byte arrays, 141
CCacheDisplayOrder method, columns, 269CancelEdit method, IEditableObject
binding controls to data sources, 157overview of, 329transacted additions to collections, 439–441transacted editing, 417–420
CancelEventHandler, validating event, 460–461
CancelNew method, ICancelAddNew, 326, 425–426
Caption property, 47–48Cell events, DataGridView, 277–281Cell templates, 222–223Cell types, built-in, 240Cell types, custom, 270–273CellFormatting event
controlling displayed cell content with, 232
creating grouped column DataGridView, 347–348
DataGridView validation with, 462overview of, 227–231
CellPainting event, DataGridViewcustomizing cell painting process, 269for header cells, 255–256modifying cell painting behavior, 348–349
CellParsing eventDataGridView validation, 462–463DataGridViewTextBoxColumn, 249–250grid data edits, 256
Cells, errors in DataGridView, 467CellTemplate property
customizing columns, 274–275DataGridComboBoxColumn, 252DataGridViewColumn, 246
CellType property, DataGridViewColumn, 246
CellValidated event, 462–463CellValidating event, 462–463CellValueNeeded event
overview of, 239setting up virtual mode, 234, 236–237virtual mode using, 240
CellValuePushed event, 240, 250Chaining binding sources, 116–121Change Data Source dialog, 44–45Chart controls, data-bound. See DataBound-
BarChartControlCheckBox control
as default control type, 190icon, 191overview of, 580–581using DataGridViewCheckBoxColumn, 251
CheckChanged event, CheckBox control, 580–581
CheckChanged event, RadioButton control, 581
CheckState property, CheckBox control, 580–581
CheckState property, DataGridViewCheck-BoxColumn, 251
Child controls, 552, 567Child relations. See Parent-child data bindingChildObject, 121Choose Toolbox Items dialog, 199, 351Classes
layered application architecture, 21–22partial, 51, 545–565
Noyes.book Page 674 Thursday, December 15, 2005 3:57 PM
INDEX 675
typed data sets as, 37Windows Forms architecture, 567–570
Clear method, IList, 300–301ClickOnce, 27Client-side transactions, ADO.NET, 650–651Clone method, custom column types, 275Code
BarChartControl, 384–391designer-generated, 202–205generating data-binding code for existing
controls, 199–201setting control data binding in Properties
window, 205–210table adapter designer-generated, 55–56typed data set-generated, 49–52using typed data sets in your, 78–79
Code-behindhooking up dynamic behavior in, 492–495XAML, 538, 540
Code view, 526Collections
access control with ICollection, 295–298adding controls to Windows Forms, 552adding search functionality to, 430–431adding sort functionality to, 432–439binding to grid with templates, 541–543business object, 405–408customizing control mappings, 197–198data binding with interfaces. See Interfacesdata sets and, 19defined, 16generating bound controls from data
sources, 189–196object, 237using BindingList<T>. See BindingList<T>
classColumnChanged event, DataTable, 652ColumnChanging event, DataTable, 652ColumnCount property, TextBox, 224ColumnHeadersDefaultStyle property, Data-
GridView, 281–282ColumnIndex property, DataGridViewCell,
242Columns. See also Built-in columns, Data-
GridViewadding to data sets, 48–49automatically sizing, 259–261, 375–376built-in. See DataGridViewColumncapturing data errors on, 477–479cell-oriented grid features for, 277–281
customizing content with unbound columns, 226–232
DataGridViewButtonColumn, 250DataGridViewCheckBoxColumn, 251DataGridViewImageColumn, 251DataGridViewLinkColumn, 250DataGridViewTextBoxColumn, 249–250defining grids in designer, 263–266freezing, 262–263grouped in DataGridView, 345–350header cells for, 255–256implementing custom type of, 269–270,
273–277programmatically adding to grid, 222–224reordering, 266–269setting name of database, 39updating database with data sets, 624–628
ComboBox controlAutoComplete feature, 160–162, 371–375binding data collections to, 88–90dynamically populating, 368–369handling grid data edits with, 257icon, 192.NET Framework 2.0 enhancements, 85–86overview of, 584Smart Tag, 213using DataGridComboBoxColumn,
252–255CommandField, DataGrid control, 511CommandType property, stored procedures,
624CompareTo method, SortComparer, 435Complex data binding
customizing control mappings with, 198–199
to individual properties on controls, 134–141
.NET Framework 2.0 enhancements, 84–85using IList, 302
ComplexBindingProperties attribute, 361Component base class, Windows Forms,
567–568ComponentType property, PropertyDescrip-
tor, 306Concurrency
ensuring data consistency with, 457handling in ADO.NET, 628–631resolving errors, 483–484
.config extension, 60Configure Data Source wizard, 505
Noyes.book Page 675 Thursday, December 15, 2005 3:57 PM
INDEX676
Connectionsadding new, 6–8choosing database, 181–184data reader, 620–621, 654–655using table adapters for, 58–62
connectionStrings configuration, 58–62Constraints, typed datasets, 33Consumers
defined, 288implementing IEnumerable for, 289–290notifying of changes to collection, 313–315
ContainerControl class, 569Contains method, BindingSource, 121ContainsListCollection property, GetList
method, 304ContentBounds property, DataGridViewCell,
242ContextMenuStrip property, DataGridView-
Cell, 242ContextMenuStrip property, DataGridView-
Column, 246Control base class
common controls. See Controls, displaydesigning data-bound controls from, 20handling control events, 574–576Windows Forms architecture, 567–570
Control composition model, WinFx, 523Control layout, 589–596
anchoring, 590–592creating Windows Forms application,
551–552, 554docking, 592–594positioning and sizing, 589–590setting tab order, 596–598snap-lines simplifying, 557–558using layout container controls, 595–598WinFx applications, 526
Controls. See also Data-bound controlsbinding data to individual, 90–92binding to data sources. See Data sources,
binding controls tocreating custom user, 586–588developing Windows Forms and, 548handling events, 574–576working with Toolbox, 555–557
Controls, display, 578–586Button, 580CheckBox, 580–581ComboBox, 584DataGrid, 585–586
DataGridView, 586DateTimePicker, 582Label, 579–580ListBox, 582–584ListView, 584overview of, 578–579PictureBox, 585RadioButton, 581RichTextBox, 582TextBox, 581TreeView, 585
ControlUpdateMode property, Binding-Source, 162–163
Converter property, PropertyDescriptor, 306ConvertEventArgs, 149, 154–155ConvertEventhandler, 149CopyTo method, ICollection, 296–297Count property, ICollection, 296CreateBindings method, 152–153CreateCells method, 225–226CreateNavigator, 666CTP (Community Technology Preview), 522CurrencyManager
changing current record in set of data with, 99
defining, 92ICurrencyManagerProvider interface, 341synchronizing data between controls, 96–97
Current propertyIEnumerator interface, 291manipulating data through binding source,
122CurrentChanged event, 131–133, 169–172CurrentItemChanged event, 131Cursor, data reader as, 656–657Custom collections, 237–238CustomBusinessObjects example, 408–416
binding through Data Sources window, 453–455
customer and order classes, 408–410forming controls, 410–413generating test data, 413–414
Customer objectsbinding to form controls, 410–413implementing data-bound business objects,
408–410PropertyChanged events, 420–423
CustomerIDChanged event, Property-Changed events, 421–423
Noyes.book Page 676 Thursday, December 15, 2005 3:57 PM
INDEX 677
CustomerNameChanged event, Property-Changed events, 421–423
CustomersRow class, 38–40, 52CustomersTableAdapter class, 47, 63–64
DData access layer
adding helper methods in, 66–67layered application architecture, 21–27table adapters and, 67
Data adaptersevents, ADO.NET, 651–654loading data sets from database and,
616–618updating database with, 626–628using Update method on, 33
Data-bind method, ASP.NET, 496Data binding
adding to custom controls, 357–359building applictions with Windows Forms.
See Windows Forms applications, building data-bound
business objects. See Business objectsconcepts, 82–84data paths within data sources, 92–96defining, 2–3, 81–82designer initialization of, 359–360expressions, 508–509to grid, 86–87IList enabling, 298–303to individual controls, 90–92key interfaces involved in. See Interfacesmaster-details, 104–106to multi-valued controls, 88–90.NET Framework 2.0 and, 84–86paging through data, 99–104smarter data containment and, 97–99synchronizing data between controls, 96–97updating data sources through, 106–108
Data-binding expressions, ASP.NET, 496–498, 508–509
Data-bound columns, 264–265Data-bound controls
ASP.NET 1.X, 490–491binding customers and orders to form,
410–413data paths within data sources and, 92–96data source mappings and, 10–11generating, 11–12
.NET Framework 2.0 and, 84–86overview of, 20–21simple data binding and, 83–84synchronizing data between, 96–97validation, 459, 463, 473with Visual Studio Designer. See Visual
Studio Designer, bound controlsWinFx, 524, 530–535, 543–545XAML, 539–540
Data-bound controls, customizing, 343–398adding data-binding capability, 357–359autocomplete, 371–375autosizing columns, 375–376building from scratch, 379chart controls for decision support, 379–384coding, 384–391delayed initialization, 362–366designer initialization, 359–360developing, 353–354editing, 391–397filtered grid control, 354–356, 377–378grouped columns, 345–350overview of, 343–345specifying binding properties, 360–362specifying data source properties, 367–371test container, 352–353using, 350–352
Data concurrency, 457, 483–484Data connections. See ConnectionsData contexts, 536, 543Data display controls
Button, 580CheckBox, 580–581ComboBox, 584DataGrid, 585–586DataGridView, 586DateTimePicker, 582label, 579–580ListBox, 582–584ListView, 584overview of, 578–579PictureBox, 585RadioButton, 581RichTextBox, 582TextBox, 581TreeView, 585
Data itemsdefined, 16defining, 286–287PropertyDescriptors and, 305–307
Noyes.book Page 677 Thursday, December 15, 2005 3:57 PM
INDEX678
Data memberscustomizing control mappings, 196,
197–199defined, 7generating data-binding code for existing
controls, 201specifying for bound controls, 94–95
Data objects, 8–10, 16–18Data persistence layer (data tier), 15Data providers, 6–7, 604–607Data readers
defined, 607filling binding source with, 126–128loading DataTable with, 619–621reading data into business objects, 654–658
Data relations, typed datasets, 33Data rows
capturing errors on, 475–479data sets containing, 31moving between DataRowView and,
123–124Data Set Designer
adding tables to data sets, 48–49creating typed data sets, 43–45setting up connections, 45–48
Data setscapturing data errors on, 475–479choosing custom collections vs., 237as collection of collections, 303–304defined, 31as fancy collection class, 405–406overview of, 31–32using in this book, 18–20
Data sets, ADO.NETcreating master-details, 621–623creating programmatically, 611–613data adapter events and, 651–654loading DataTable with data reader,
619–621loading from database, 613–619loading from file, 609–611master-details, 621–623merging data from multiple, 639–641searching, 637–638structure of, 607–609updating with, 624–628, 632–637
Data Source Configuration wizardadding data sources to project, 179–180adding database data source, 181–184
adding new data source and data connection, 6–8
adding object data source, 186–189adding Web service data source, 185–186choosing type of data source, 180creating new data sources in property
editor, 207designer-generated code files and, 205selecting data objects, 8–10
Data source control, ASP.NET 2.0DataGrid control working with, 510defined, 498–499using master-details data binding, 515–518
Data sourcesadding new, 6–8binding attributes, 360–362binding hierarchical, 518choosing typed data set, 44–45creating bound controls. See Data Source
Configuration wizardcustomizing control mappings, 10–11data binding through BindingSource, 97–99data contexts and, 536data paths within, 92–96data providers, 604–605defined, 31designer-generated code files, 202–205dynamically determining properties of,
367–371ErrorProvider extracting information from,
466–467overview of, 15–16paging through data, 99–104selecting in Property window, 207in simple data binding, 91updating through data binding, 106–108updating typed data sets with table
adapters, 57–58using designer to define grids, 263–266
Data sources, ASP.NET, 499–508AccessDataSource control, 507ObjectDataSource control, 505–507overview of, 499–500SiteMapDataSource control, 508SqlDataSource control, 500–505XmlDataSource control, 507–508
Data sources, binding controls to, 111–176AutoComplete feature, 160–162automatic formatting and parsing, 147–148binding events, 148–154
Noyes.book Page 678 Thursday, December 15, 2005 3:57 PM
INDEX 679
BindingSource, as data storage container, 124–126
BindingSource, chaining for master-details, 116–121
BindingSource, filling with data reader, 126–128
BindingSource, manipulating data through, 122–124
BindingSource, navigating data through, 121–122
BindingSource, overview of, 111–112BindingSource, sorting, searching and
filtering with, 128–130child-parent data binding, 163–165complex types, 134–141data binding lifecycle, 162–163DateTime column to DateTimePicker,
142–144DateTime column to TextBox, 144–145editing completion, 157–160Format event, 154–155image column to PictureBox, 141–142monitoring with events, 131–133multiple copies of data, 165–168nullable types, 140–141numeric column to TextBox, 145–147Parse event, 156–157restricting changes to data, 133simple data binding, 112–115synchronizing many-to-many related
collections, 172–176type conversion process and format
providers, 138–139updating to parent data-bound controls,
168–172Data Sources window
adding data sources, 179–180adding object data sources, 188–189adding outside data sources, 202binding to business objects in, 453–455creating typed data sets in, 41–42customizing control mappings in, 196–199generating bound controls from data
sources in, 189–196generating data-binding code for existing
controls on, 199–201working with, 177–179
Data storage container, BindingSource as, 124–126
Data structures, 405
Data tablesbinding to DataView when binding to, 113capturing data errors on, 475–479defined, 609form controls and components from,
192–193loading with DataReader, 619–621
Data tier, 15Data type drop-down list, 197–199Data UI Customization settings, 199DataBind, ASP.NET, 494DataBinder.Eval method, ASP.NET, 509DataBindingComplete event, 221, 376DataBindings property, 90–92, 208–209DataBoundBarChartControl
adding editing support to, 391–397class definition for, 385–386implementing BarChartControl, 381–383overview of, 380–381
DataBoundBarChartControl, coding, 384–391
defining custom control skeleton, 385–386initializing and updating data bindings,
387–389overview of, 384–385using AddBarChartControl method,
389–391DataColumn instances, 31DataError event, 132DataErrorEventArgs, DataGridView,
468–471DataFile property, AccessDataSource control,
507DataGrid control
ASP.NET, 490–492, 494, 509–510DataGridView vs., 220limitations, 217overview of, 585–586
DataGridView control, 217–284automatic column sizing, 259–262basic data binding with, 219–221binding data collections to grid, 86–87built-in header cells, 255–256calling EndEdit in, 159column and row freezing, 262–263column reordering, 266–269controlling modifications, 221–222custom cell types, 270–273custom column content with unbound
columns, 226–232
Noyes.book Page 679 Thursday, December 15, 2005 3:57 PM
INDEX680
DataGridView control, continuedcustomizing control mappings, 198DataError event, 468–471as default control type, 190defined, 586defining custom column type, 273–277deriving controls from, 21formatting with styles, 281–283grid data edits, 256–259grouped columns, 345–350master-details data binding, 104–106overview of, 218–219programmatically adding columns, 222–224programmatically adding rows, 224–226row and cell error displays, 467–468transacted object editing, 417–420using Visual Studio Designer, 263–266utilizing cell-oriented grid features, 277–281validation events, 462–463
DataGridView control, built-in column types, 241–255
DataGridViewButtonColumn, 250DataGridViewCell properties, 242–246DataGridViewCheckBoxColumn, 251DataGridViewColumn properties, 246–249DataGridViewComboBoxColumn, 252–255DataGridViewImageColumn, 251–252DataGridViewLinkColumn, 250DataGridViewTextBoxColumn, 249–250overview of, 241–242
DataGridView control, virtual mode, 233–241choosing data sets or custom collections,
237–238initializing grid, 238–239overview of, 233–234setting up, 234–237summary, 240–241understanding behavior of, 239–240
DataGridView icon, 191DataGridViewAutoSizeMode, 259–260DataGridViewButtonColumn, 250DataGridViewCell class
built-in cell types derived from, 240cell templates as instances of, 222properties, 242–246working with built-in header cells, 256
DataGridViewCell Style, 282DataGridViewCell.CellStyle property, 282DataGridViewCellStyle object, 226
DataGridViewCheckBoxColumn, 251DataGridViewColumn, 240, 246–249DataGridViewColumn.DefaultCellStyle
property, 281–282DataGridViewColumnHeaderCell, 255DataGridViewComboBoxColumn, 252–255DataGridViewImageColumn, 251–252DataGridViewLinkColumn, 250DataGridViewRow.DefaultCellStyle
property, 282DataGridViewRowHeaderCell, 255DataGridViewSelectionMode, 277–280DataGridViewTextBoxCell class, 223–224DataGridViewTextBoxColumn, 223, 249–250DataGridViewTextBoxEditingControl,
249–250dataMember parameter, Binding class, 136DataMember property
DataBoundChartControl, 386DataGridView, 219–221master-details data binding, 105–106
DataMemberChanged event, 132, 221DataPropertyName property, 227, 246DataRowState, 625DataRowView class
implementing IEditableObject, 157moving between DataRow and, 123–124supporting transacted object editing,
417–420DataSet
ADO.NET, 607–609icon, 191
DataSet property, XmlDataDocument, 659.datasource files, 202–203dataSource parameter, Binding class, 136DataSource property
adding columns to grid, 264–265adding rows to grid, 227binding data collections to grid, 86–87complex data binding using, 84creating Windows Forms application,
553–554data binding with DataGridView, 220–221DataGridComboBoxColumn, 253defining custom control skeleton, 386master-details data binding, 105–106.NET Framework 2.0 and, 85simple data binding, 113–114
DataSourceChanged event, 132, 221
Noyes.book Page 680 Thursday, December 15, 2005 3:57 PM
INDEX 681
DataSourceID propertyfor ASP.NET data-bound controls, 500data-binding expressions, 509DataGrid control, 510–511
dataSourceUpdateMode parameter, Binding class, 136
DataSourceUpdateMode property, 163, 209–210
DataTableevents, 651–652overview of, 31–33using DataView and, 123
DataTextField property, ASP.NET Drop-DownList control, 497
DataValueChanged event, 397DataValueField property, ASP.NET Drop-
DownList control, 497DataView class
binding to data tables really binding to, 113defining, 123implementing ITypedList, 307–309as key class for data binding, 287working with in ADO.NET, 641–642
DateTime column, DateTimePicker, 142–144DateTime column, TextBox, 144–145DateTimeFormatInfo provider, 145DateTimePicker control
binding DateTime column to, 142–144as default control type, 190icon, 192limitations of, 144overview of, 582
DBConcurrency exception, 483DBNull, 140–141, 155Debugging
running FirstDataApp, 13–14in Visual Studio, 563
Declarative programming, design-time, 378DefaultBindingProperties attribute, 361DefaultCellStyle property, 246, 281–282DefaultNewRowValue property, DataGrid-
ViewCell, 242DefaultStatus property, custom columns,
274–276Definitions, data set tables, 44Delegate inference, 575Delete method, table adapters, 54DeleteCommand property, database
updates, 626Design tools, 36
Designer. See Visual Studio Designer, bound controls
Designer view, 526.Designer.cs extensions
adding database data sources, 184defined, 49–50example, 50–52
.Designer.vb extensions, 49–50DesiredType property, ConvertEventArgs,
149–150Details view, Data Sources window, 191,
195–196DetailsView control, ASP.NET, 512–514, 515Direction, in data binding, 82–83DirectX graphics engine, in WinFx, 523Disconnected data access, ADO.NET, 603Displayed property, DataGridViewCell, 243DisplayIndex property, 247, 267–269DisplayMember property
ComboBox control, 85–86, 88–90DataGridComboBoxColumn, 253setting in Properties window, 207–208
DisplayStyleForCurrentCellOnly property, DataGridComboBoxColumn, 253
Dispose methodIDisposable interface, 293loading DataTable with data reader, 620Windows Forms architecture, 570
DividerWidth property, DataGridView, 247, 262–263
Dock propertyDataGridView Smart Tag, 265docking controls, 592–594
Drag and drop process. See Mouse clicksDropDownList control, ASP.NET, 497DropDownStyle, ComboBox, 584DropDownWidth property, DataGrid-
ComboBoxColumn, 253DumpList method, IBindingList, 320
EEdit
adding to custom data bound controls, 391–397
binding controls to data sources, 157–160DataGridViewTextBoxColumn, 249–250FormView, 515grid data, 256–259INotifyPropertyChanged, 423–424
Noyes.book Page 681 Thursday, December 15, 2005 3:57 PM
INDEX682
Edit, continuedPropertyChanged events, 420–423supporting transacted object, 416–420using Data Sources window toolbar,
179–180Edit Columns dialog, 263–264, 276–277EditedFormattedValue property, DataGrid-
ViewCell, 243EditingControlShowing event, 257–258EditType property, DataGridViewCell, 243EnableVisualStyles method, Windows
Forms, 572EndEdit method
ISupportInitialize, 335–337ISupportInitializeNotification, 338–341updating bound controls, 170using BindingSource as data storage
container, 125–126EndEdit method, IEditableObject
overview of, 157–159transacted additions to collections, 439–441transactional editing of objects, 328–329,
417–420EndNew method, ICancelAddNew, 326,
425–426Error handling, 457–485
capturing errors on data sets, 475–479data concurrency resolution, 483–484DataGridView, 467–468DataGridView DataError event, 468–471IDataErrorInfo interface for, 330–331,
479–482overview of, 457–458validation controls, 474–475validation down control hierarchy, 472–473validation events, handling, 459–462validation events, with DataGridView,
462–463validation up control hierarchy, 463validation, with AutoValidate property,
471–472validation, with ErrorProvider, 464–467Windows Forms validation, 458–459
Error property, IDataErrorInfo, 331ErrorIconBounds property, DataGridView-
Cell, 243ErrorProvider control, 459, 464–467ErrorText property, DataGridViewCell, 243Esc key, transacted object editing, 417, 420
Eval method, data-binding expressions, 509EventHandler
control events, 574–576creating Windows Forms with Visual
Studio, 561–563PropertyChanged events, 421–423
Eventsbinding, 148–154BindingSource, 131–133control, 574–576controlling modifications to data in grid,
221–222data sets and data adapter, 651–654DataGridView cell, 277–281DataGridView DataError, 468–471DataGridView validation, 462–463DataTable, 651–652IBindingList, 312–313paging through data with, 101–103populating column cells through, 227typed data table, 38–39validation, 459–462validation based on, 459virtual mode, 234Windows Forms architecture, 570
ExecuteNonQuery method, SqlCommand, 646–647
ExecuteReader method, 621ExecuteScalar method, SqlCommand, 646Expressions
adding tables to data sets, 48–49ASP.NET data-binding, 496–498, 508–509
Extended provider control, defined, 464Extensible Application Markup Language.
See XAML (Extensible Application Markup Language)
FFat client. See Smart client applicationsFault tolerance, 25Fields, 7Fill, AutoSizeMode, 260–261Fill method
filling typed data sets with table adapters, 56–57
loading data sets from database, 616–618untyped data sets, 32–33Update method vs., 33
FillError event, SqlDataAdapter, 654
Noyes.book Page 682 Thursday, December 15, 2005 3:57 PM
INDEX 683
FillWeight property, AutoSizeMode, 261FillWeight property, DataGridViewColumn,
247Filter property
IBindingListView, 323–325, 444setting on binding source, 130synchronizing many-to-many relationships,
175–176Filtered grid control
adding data-binding capability, 357–359autocompleting input, 371–375autosizing columns in grid, 375–376building, 354–356delayed initialization, 362–366determining properties of data source,
367–371specifying binding properties on controls,
360–362summary, 376–378
FilterExpression property, SqlDataSource control, 515–517
Filtersdata view supporting, 642IBindingListView supporting, 323–325,
443–453master-details binding supporting, 516–517removing from collections, 325
Find methodBindingSource, 121, 129–130creating rich object collections, 426IBindingList, 312
FindCore method, 430–431FlatStyle property, DataGridComboBox-
Column, 253FlowDirection property, FlowLayoutPanel
control, 595FlowLayoutPanel control, 595–597Font, BarChartControl, 383foreach operator, IEnumerable and IEnumer-
ator, 292–293, 294Form class, 15, 569Format event
event binding and, 149–150, 153–154handling, 154–155
Format providers, 138–139, 147–148FormatException, 148formatInfo parameter, Binding class, 137FormatString parameter, 137, 145–147
FormattedValue property, DataGridView-Cell, 243
FormattedValueType property, DataGrid-ViewCell, 243
Formattingthe data, 135data binding lifecycle, 163with styles, 226, 281–283
Formatting and Advanced Binding dialog, 209–210
FormattingApplied property, 230, 260FormattingEnabled parameter
binding DateTime column to TextBox, 145binding numeric column to TextBox, 146overview of, 136–138
FormView control, ASP.NET, 514–515Frozen property
column and row freezing with, 262–263DataGridViewCell, 243DataGridViewColumn, 247
GGeneric collection classes, 406–408Generic data classes, ADO.NET, 604Generics, defined, 287Get Visited Count button, virtual mode, 240GetColumnsInError method, 477–479GetCustomers method, objectDataSource
control, 506–507GetEnumerator method, IEnumerable, 290,
292GetEnumerator method, IEnumerator<T>,
293GetFormattedValue method, custom cell
types, 272–273GetItemProperties method, ITypedList,
308–309GetManifestResourceStream method, cus-
tom cells, 273GetOrdinal method, data reader, 657GetProperties method, 367GetRegions method, 633–634GetString method, data reader, 656–657GetTestCustomers method, 413–414GetValue method, PropertyDescriptor, 306GetXML method, loading data sets, 609Global exception handlers, 573–574Graphics, WinFx, 523
Noyes.book Page 683 Thursday, December 15, 2005 3:57 PM
INDEX684
Gridsadding to Windows Forms, 550–552binding customers and orders objects to
form controls, 410–413binding data collections to, 86–87binding through BindingSource, 112–115handling data edits, 256–259handling row selecting in, 495–496implementing data-bound business objects,
408–410master-details data binding in, 104–106presenting tabular data. See DataGridView
controltemplates in XAML binding collections to,
541–543WinFx, 526, 530–531
GridView control, ASP.NET, 509–512, 513–514Grouped columns, 345–350
HHasErrors boolean property, 477HasStyle property, DataGridViewCell, 244Header cells, built-in, 255–256HeaderCell property, DataGridViewColumn,
247HeaderText property, DataGridViewColumn,
247“Hello World” application, WinFx, 526–528Heterogenous columns, DataGridView,
224–225Hierarchical binding, ASP.NET, 518Hierarchy, Windows Forms, 567–570Hollis, Billy, 475Hot cells, 281HTML, ASP.NET Web forms, 491HTTP POST, ASP.NET, 489
IIBindableComponent interface
data-bound controls and, 20–21.NET Framework 2.0 and, 85simple data binding with, 84–85
IBindingList interface, 310–322binding to data tables, 113BindingList<T> implementation, 425exercising change notifications, 316–317filter function, 128–130notifying consumers of changes, 313–315
overview of, 310–313restricting changes to data, 133search function, 128–130, 322sort function, 128–130, 317–321using for IList interface limitations, 303
IBindingListView interfaceadding functionality of, 443–453multi-property sorting with, 318overview of, 323–325sorting with, 129–130
ICancelAddNew interfacecreating custom collection types, 425–426overview of, 325–326using BindingList<T>, 425–426
ICollection interface, 295–298ICollection<T> interface, 298IComparer<T> interface, 433–435Icons, data sources controls, 189–192Icons, ErrorProvider control, 466IConvertible interface, 148ICurrencyManagerProvider interface, 341,
365ICustomTypeDescriptor interface, 332–334id attribute, ASP.NET controls, 492Id property, virtual mode, 237–238IDataErrorInfo, 330–331, 483–484Identity values, 633IDisposable interface
IEnumerator<T> class deriving from, 293implementing BarChartControl, 383Windows Forms architecture, 570
IEditableObject interfacecalling EndEdit, 159DataRowView class implementing, 157ICancelAddNew interface vs., 325managing transacted additions to
collections, 439–441overview of, 328–329transacted editing of objects with, 416–420
IEnumerable interface, 289–295, 301IEnumerator<T> class, 293IList interface
complex data binding with, 85–86defined, 288–289List<T> implementation, 411overview of, 298–303
IListSource interface, 303–305IList<T> interface, 303Image column, PictureBox control, 141–142
Noyes.book Page 684 Thursday, December 15, 2005 3:57 PM
INDEX 685
Image property, PictureBox/TreeView control, 585
ImagesDataGridViewImageColumn for, 251–252PictureBox control for, 580, 585
Implementers, 288Indexers, data readers, 656–657IndexOf method, BindingSource, 122IndexOf method, IList, 300Indigo (Windows Communication
Foundation), 521InheritedAutoSizeMode property, DataGrid-
ViewColumn, 247InheritedStyle property, DataGridViewCell,
244InheritedStyle property, DataGridView-
Column, 247InitData method, 118, 237–238Initialization
coding custom-bound controls, 387–389delayed, data-bound controls, 362–366ISupportInitialize, 334–337ISupportInitializeNotification, 337–341Main method and, 573using designer, 359–360
InitializeComponent methoddefining grids in designer, 266designer-generated code, 202ISupportInitialize, 335–336overview of, 565–566in XAML, 540
Initialized event, DataSet, 651INotifyPropertyChanged interface
business object edit notifications with, 423–424
overview of, 329–330raising item changed events, 439using for IList interface limitations, 303
INotifyPropertyCollectionChanged inter-face, WinFx, 536
Input validation, 474–475Insert method, IList, 300Insert method, table adapters, 54INSERT stored procedure, 637InsertCommand property, updating with
data adapters, 626InsertTemplate, FormView, 515IntelliSense, 36Interfaces, 285–342
data binding and, 286–289
IBindingListView, 323–325ICancelAddNew, 325–326ICollection, 295–298ICurrencyManagerProvider, 341ICustomTypeDescriptor, 332–334IDataErrorInfo, 330–331IEditableObject, 328–329IEnumerable and IEnumerator, 289–295IList, 298–303IListSource, 303–305implementing with data providers in .NET,
605INotifyPropertyChanged, 329–330IRaiseItemChangedEvents, 327ISupportInitialize, 334–337ISupportInitializeNotification, 337–341ITypedList, 307–309overview of, 285–286property descriptors, 305–307WinFx, 536
Interfaces, IBindingList, 310–322exercising change notifications, 316–317notifying consumers of changes, 313–315overview of, 310–313search function, 322sorting function, 317–321
IntiGrid method, 238–239IRaisedItemChangedEvents, 441–443IRaiseItemChangedEvents interface, 327Is<ColumnName>Null method, 140–141IsDataBound property, DataGridView-
Column, 248IsFixedSize property, IList, 299, 301IsInEditMode property, DataGridViewCell,
244IsInitialized property, ISupportInitialize-
Notification, 339–341IsMdiContainer property, MDI, 577–578Isolation levels, transaction, 645IsPostBack property, 495IsReadOnly property, IList, 299, 301IsSorted property, IBindingList, 311IsSynchronized property, ICollection,
297–298ISupportInitialize
DataBoundBarChartControl implementing, 386
delayed initialization with, 362–366overview of, 334–337
Noyes.book Page 685 Thursday, December 15, 2005 3:57 PM
INDEX686
ISupportInitializeNotification interface, 337–341
Items property, DataGridComboBoxColumn, 254
ItemsSource property, WinFx data binding, 535
Iteration, IEnumerable and IEnumerator, 290–292
ITypedList interface, 307–309
LLabel controls
Detail view control mapping with, 194generating for data-bound controls, 11–12icon, 191overview of, 579–580
Layered application architecture, 15–16, 21–27
Layers, 23–26, 29Layout, control. See Control, layoutLifecycle, data binding, 162–163Lifecycle, Windows Forms, 569–570LinkLabel icon, 192Links, DataGridViewLinkColumn, 250Links, defining grids in designer, 263–265List-based binding, 84ListBox control
ASP.NET, 497binding data collections to, 88–90icon, 192overview of, 582–584Smart Tag, 213–214WinFx, 535XAML, 540
ListChanged eventsBindingList<T> supporting, 425defining, 132FilteredGrid control, 370–371IBindingList, 312INotifyPropertyChanged, 329–330, 424IRaiseItemChangedEvents of, 327ListChangedEventArgs properties of,
314–315ListChangedType enumeration values, 315synchronizing many-to-many related
collections, 174–175ListChangedEventArgs properties, 314–315ListChangedType property, ListChanged-
EventArgs, 314
Lists, defined, 16ListSortDescriptionCollection, IBindingList-
View, 444List<T> generic type
adding searching to collections, 431adding sorting to collections, 432–434IList interface using, 302overview of, 407–408
ListView control, 584ListViewItem class, 584Load event, 570LoadDataRow method, 641Loading, ADO.NET
data into XPathDocument, 664–665data sets from database, 613–619data sets from files, 609–611DataTable with DataReader, 619–621
localhost, 8Location property, 589–590Logical units, WinFx, 523Lookup complex data binding, 199LookupBindingProperties attribute, 361
MMain method, 549, 570–574many-to-many relationships, synchronizing,
172–174MarshalByRefObject, 567–568MaskedTextBox control, 144Master-details data binding
ASP.NET, 515–518chaining BindingSources for, 116–121generating controls with designer, 214–216implementing data-bound business objects,
408–410overview of, 104–106reversing, 168–172
Master-details data sets, ADO.NET, 621–623MaxDropDownItems property, DataGrid-
ComboBoxColumn, 254MDI (multiple-document interface) applica-
tions, 577–578MdiParent property, MDI applications, 578Member controls, Windows Forms, 567MemberDescriptors, 305–306Members, adding, 557–561Memory. See DataGridView control, virtual
modeMenuStrip control, 598–600
Noyes.book Page 686 Thursday, December 15, 2005 3:57 PM
INDEX 687
Merge method, ADO.NET, 639–641MergeFailed event, DataSet, 651MFC (Microsoft Foundation Class), 49–50Microsoft SQL Server
as data provider in .NET, 604loading data sets from database, 613–619working with, 606–607
MinimumWidth property, DataGridView-Column, 248
MissingSchemaAction property, 622, 634Mouse clicks
configuring table adapters to use stored procedures, 76
generating data-bound controls, 11, 200–201generating form controls and components,
193–194working with Data Sources window, 177
MoveFirst method, BindingSource, 122MoveLast method, BindingSource, 122MoveNext method
IEnumerator, 290, 292, 294navigating data through BindingSource,
122XPathNavigator query methods, 666
MovePrecious method, BindingSource, 122MoveToXXX methods, XPathNavigator,
668–669Multiline property, TextBox control, 581multiple-document interface (MDI) applica-
tions, 577–578Multithreaded programming, ICollection,
297m_Visited collection, 239
NName property, DataGridViewColumn, 248Name property, PropertyDescriptor, 306Namespace, icon, 191Namespace, XPathNavigator, 669Naming conventions
adding tables to data sets, 48–49configuration files at runtime, 60data-bound controls, 11generating bound controls from data
sources, 194hooking up event handler to get different,
561–563loading data sets from database, 616–619
setting control data binding in Properties window, 206
typed data sets, 39, 47–48Navigation
with BindingNavigator. See BindingNavigator control
BindingSource properties and methods, 121–122
of XML documents. See XPathNavigatorXML documents, 667–669
.NET Framework 2.0data binding enhancements, 84–86data sets, 19–20generic collection classes, 406–408
.NET Framework Data Provider, 45Never value, DataSourceUpdateMode
property, 163New Connection button, 6–7New Project dialog, 4–5, 554–555NewIndex property, ListChangedEvent-
Args, 314No mapping icon, 191NodeType property, XPathNavigator, 667NotSortable property, DataGridView, 280Null value
binding numeric column to TextBox, 146customizing bindings in Properties
window, 209handling Format event, 155overview of, 140–141
Nullable types, 140nullValue parameter, Binding class, 137Numeric columns, binding to TextBox,
145–147NumericUpDown control icon, 192
OObject collections, 237Object reference, 129–130ObjectDataSource control, 505–507, 518Objects
data-bound business. See Business objectsoverview of, 16–18performing data binding against, 186–189
ObservableCollection<T> class, 536ODBC, 604Offline applications, 27, 603OldIndex property, ListChangedEventArgs,
314
Noyes.book Page 687 Thursday, December 15, 2005 3:57 PM
INDEX688
OLE DB, 604OLE images, conversion handling, 142OnAddingNew event handler, 125–126OnCellFormatting, DataGridView override,
347–348OnCellPainting method, DataGridView
override, 348–349OnCellValueNeeded handler, virtual mode,
239OnCountryComboChanged event, 258–259One-way data binding, 82OnFilterClicked event handler, 374OnFormLoad method, paging through data,
101–102OnGetList method, bound controls, 412OnGetVisitedCount button Click handler,
virtual mode, 239OnLoadData handler, 552–553OnPositionChanged event handler, 102–103OnPropertyChanged value, DataSource-
UpdateMode property, 163OnSelectedIndexChanged event, 495OnStartingUp method, WinFx, 529–530OnValidating value, DataSourceUpdate-
Mode property, 163Optimistic currency, 33Oracle, 605Order objects, 410–413OwningColumn property, DataGridView-
Cell, 244OwningRow property, DataGridViewCell,
244
PPage processing, ASP.NET
handling row selecting in grid, 495–496hooking up dynamic behavior in
code-behind files, 492–495overview of, 489
Page_Load event handler, 494Paging, DataGrid control, 511Paging, FormView, 515Painting, custom and row headers, 255–256Parent-child data binding
master-details data binding using, 117–121overview of, 163–165updating to parent data-bound controls,
168–172
Parsingdata binding lifecycle, 163event binding with Parse event, 153–154handling Parse event, 156–157overview of, 147–148Parse event, 149
Partial classes, 51, 545–565Passing the data, 135PasswordBox control, 530–531Performance, 25, 68PictureBox control
binding image column to, 141–142customizing data source control mappings,
10generating data-bound controls, 12icon, 191label control vs., 579overview of, 585
Pixel-based programming, WinFx vs., 523plus sign (+), 202Position property, 99–100, 121PositionChanged event, 101–103, 132Postback handling, DataGrid control, 510Pragmatic ADO.NET (Wildermuth), 602PreferredSize property, DataGridViewCell,
244Presentation layer
of layered application architecture, 21–27using data readers in, 607using data sets in, 18–19
Preview Data option, Smart Tag, 212–213Programmatically constructing data sets,
611–613Programming .NET Components (Löwy), 407,
574Programming Windows Presentation Foundation
(Sells and Griffiths), 522Programming, Winfx UI, 522–524Properties
data-bound business object, 404DataGridComboBoxColumn, 252–254DataGridView, 218DataGridView cell styles, 281–283DataGridViewCell, 242–246DataGridViewColumn, 246–249defined, 7designing own data-bound controls from, 21dynamically determining data source,
367–371
Noyes.book Page 688 Thursday, December 15, 2005 3:57 PM
INDEX 689
exposing data-binding, 307–309setting control data binding, 206–210setting values with designer-generated
code, 565sorting on multiple. See IBindingListView
interfacetransacted object editing, 416–420typed data set, 37–38, 47–48
Properties windowadding member to Windows Forms,
557–560DataGridView settings in, 266hooking up event handler in, 561–563setting control data binding in, 205–210
Property change events, 420–424PropertyChangedEventHandler, 330PropertyDescriptor
determining properties of data sources, 367–371
ListChangedEventArgs, 315manipulating data through binding source,
124overview of, 305–307
propertyName parameter, Binding class, 136PropertyType property, PropertyDescriptor,
306PropertyUISettings, data source files, 204ProposedValue property, DataTable, 652–653Provider model, ASP.NET, 499–500Provider-specific classes, ADO.NET, 604Pseudo-properties, Properties window,
206–210
QQueries
loading data sets from database, 616–617table adapters configured for custom, 69–72table adapters configured for stored
procedures, 74–77using Smart Tags, 210–214writing SQL statements with Query
Builder, 72–73against XML data, 665–667
Query Builder, 72–73, 212question mark (?), 140
RRadioButton control, 581RaiseItemChangedEvents property, 439–441
Raster graphics, 523Read method, data reader, 656Readers. See Data readersReadOnly property
controlling modifications to grid data, 221DataGridView Smart Tag, 265DataGridViewButtonColumn, 250DataGridViewCell, 244DataGridViewColumn, 248DataGridViewTextBoxColumn, 249–250in virtual mode, 240
ReadXml methodcreating Windows Forms application, 552loading data sets from file, 609–611working with XmlDataDocument, 661–662
Reference.map item, 203RejectChanges method, client-side transac-
tions, 650–651Relational data access, ADO.NET, 603–607Relational data, defined, 286Relations, typed data sets, 51Remove method, IList, 300–301RemoveAt method, IList, 300–301RemoveFilter method, IBindingListView,
324, 325, 444RemoveIndex method, IBindingList, 312RemoveSort method, IBindingList, 312, 317RemoveSortCore method, IBindingList,
438–439Renderers, .NET 2.0, 600Rendering, BarChartControl, 381–383Rendering, custom data structure for,
383–384Reset method, IEnumerator<T> class, 293Resizeable property, DataGridViewCell,
244Resizeable property, DataGridViewColumn,
248Rich Text Format (RTF), 582RichTextBox control, 582Rollback transactions, 645–646RowAdded event, DataGridView, 281RowChanged event, DataTable, 652RowChanging event, DataTable, 652RowDeleted event, DataTable, 652RowDeleting event, DataTable, 652RowFilter property, data views, 642RowIndex property, CellFormatting event,
230RowIndex property, DataGridViewCell, 244
Noyes.book Page 689 Thursday, December 15, 2005 3:57 PM
INDEX690
Rowsadding in virtual mode, 234errors in DataGridView, 467freezing, 262–263header cells for, 255–256programmatically adding to grid, 224–226selecting in grid, 495–496updating database with data sets, 624–628
RowsAdded eventcontrolling stored cell content with, 232defined, 227using, 231–232
RowsHeadersDefaultStyle property, 281–282RowState flag, 33RowState property, DatSet class, 625RowStateFilter property, DataView, 642RowUpdated event, SqlDataAdapter, 654RowUpdating event, SqlDataAdapter, 654RowValidated event, DataGridView, 462–463RowValidating event, DataGridView,
462–463RTF (Rich Text Format), 582Run method, 527, 572runat = "server" attribute, ASP.NET, 492Running, data-bound applications, 13–14Runtime, data binding, 37
SSaving, connection strings, 8–9Scalability, 25Scoping transactions, ADO.NET, 647–649ScrollableControl class, 569Scrollbars property, TextBox control, 581Scrolling, while freezing rows/columns,
262–263Search Criteria Builder dialog, 211Search functionality
adding to custom collections, 430–431adding to rich object collections, 426with BindingSource, 128–130data sets, in ADO.NET, 637–638with IBindingList, 322
SearchControl user control, 588–589Security
basing table adapters on stored procedures and, 68
dividing applications into tiers for, 25IEnumerable and IEnumerator interfaces
and, 294
smart clients and, 28Select method, overloads, 638SELECT query, in database updates, 627–628SelectCommand property
calling update stored procedures, 634SqlDataSource control, 500, 515updating database with data sets, 626, 627
Selected property, DataGridViewCell, 244SelectedIndexChanged event
ComboBox control, 584grid data edits, 258ListBox control, 583row selection in grid, 495
SelectedItem(s) property, ListBox control, 583SelectedValue property, ComboBox, 88–90SelectedValue property, updating
data-bound controls, 170SelectIndex property, ListBox control, 583SelectionMode property, DataGridView,
277–280SelectionMode property, ListBox control,
583–584SELECT...WHERE clause, DetailsView
control, 514Server Explorer, 44–45SetBinding method, WinFx, 535SetColumnError method, DataRow class, 476SetConnection method, 62SetDisplayOrder method, columns, 269SetError method, ErrorProvider, 465–467Settings class, connection management,
58–60SetValue method, IRaiseItemChanged-
Events, 327SetValue method, PropertyDescriptor,
306–307Show method, displaying other forms,
576–577Show method, WinFx, 527ShowDialog method, displaying other forms,
577ShowXXXButton properties, DataGrid
control, 511Simple data binding
with binding sources, 112–115customizing control mappings using,
198–199overview of, 83–84performing, 90–92using IList interface, 302
Noyes.book Page 690 Thursday, December 15, 2005 3:57 PM
INDEX 691
Site property, DataGridViewColumn, 248SiteMapDataSource control, 508Size
controls on forms, 589–590DataGridViewCell, 245PictureBox, 585TableLayoutPanel control, 595–596Windows Forms, 551, 554
Smart client applicationsconfiguring, 24–25defining, 27–28separate layers in, 29
Smart Tagsadding columns to grids, 264–266generating data bindings, 210–214working with, 556
SmlDataDocument class, ADO.NET, 659–663Snap-lines, 557–558SnycRoot property, ICollection, 297–298Solution Explorer
creating typed data sets, 43, 49–50XSD files hidden in, 42
Sort functionalityadding to collections, 432–439with BindingSource, 128–130data views, 642with DataGrid control, 511with IBinding List, 317–321with IBindingListView, 323–325, 443–453with IEnumerator, 291–292rich object collections, 426
Sort property, data views, 642SortComparer, 433–434SortComparer, adding sorting to collection,
437–438SortDescriptions property, IBindingList-
View, 323–324, 444SortDirection property, IBindingList, 311SortDirection property, IBindingListView, 324Sorted property, DataGridComboBox-
Column, 254SortExpression property, DataGrid control,
511SortMode property, DataGridView, 280SortMode property, DataGridViewColumn,
248Source property, database column names, 39Source property, typed data sets, 47–48
SplitContainer control, 595–597Splitter control, SplitContainer control, 595Spreadsheets, creating, 218SQL Express engine, 614–615SQL Server, 45–46SQL statements
adding custom query to table adapters, 69–72
configuring table adapter to use stored procedures, 74–77
writing with Query Builder, 72–73SqlCommand object, 615–616, 646SqlCommandBuilder, 627–628SqlDataAdapter class
events of, 654loading data sets from database, 616–618updating database with data sets, 626
SqlDataReader, 654–658SqlDataSource control
DetailsView control and, 514master-details data binding in, 515–518overview of, 500–505
SqlParameter class, 636–637SqlTransaction class, 643–644STAThread attribute, Main method
overview of, 572–573Windows Forms applications using, 550WinFX using, 528
StatusCells, 270–273StatusColumns, 273–277StatusImage, 276StatusStrip control, 598–600Stored procedures
basing table adapters on, 67–69configuring table adapter to use, 74–77loading data sets from database, 616retrieving data with, 623–624
Stringsautomatic formatting and parsing, 147–148filter, 175–176setting textual data-binding behavior of
custom objects, 413–414Styles
DataGridView, 281–283DataGridViewCell, 245WinFx layered, 523–524
SupportsAdvancedSorting property, IBindingListView, 323–324, 444
Noyes.book Page 691 Thursday, December 15, 2005 3:57 PM
INDEX692
SupportsChangeNotification property, IBindingList, 311, 313
SupportsFiltering property, IBindingListView, 323, 444
SupportsSearching property, IBindingList, 311, 322
SupportsSearchingCore method, 430–431SupportsSorting property, IBindingList, 317Synchronization
of data between controls, 96–97data paths within data sources, 94–96ICollection interface, 297of many-to-many relationships, 172–174updating to parent data-bound controls,
168–172System namespace, 550System.Collections namespace, 19–20System.ComponentModel namespace, 20System.Data namespace, 605System.Transactions, 647–649System.Windows namespace, WinFx, 525,
527System.Windows.Controls namespace,
WinFx, 526System.Windows.Windows.Window objects,
WinFx, 525
TTab order, controls, 596–598TabIndex property, 597Table adapters, 52–77
adding helper data access methods, 66–67adding queries to, 69–72adding transaction support to, 62–66basing on stored procedures or views, 67–69configuring to use stored procedures, 74–77connection management, 58–62defined, 35, 41designer-generated code, 55–56filling and updating typed data sets, 56–58generating data-bound controls, 11overview of, 52–56using Query Builder for SQL statements,
72–73Table-oriented complex data binding, 199TableAdapter Query Configuration wizard,
67–72TableLayoutPanel control, 595–597
TableMappings property, 618Tables
adding to data sets, 48–49creating Windows Forms application, 553loading data sets from database, 616–619presenting tabular data. See DataGridView
controlTag property, DataGridViewCell, 245Templates
binding collection to grid with, 541–543CellTemplate property, 246, 252, 274–275FormView, 515
Test container, 352–353Testing, custom controls, 350Text property
ASP.NET data-binding expressions, 497Button control, 580CheckBox control, 580–581Label controls, 580RichTextBox control, 582TextBox control, 581TreeView control, 585
TextBlock control, WinFx, 526, 530–531TextBox control
AutoComplete, 160–162, 371–375binding DateTime column to, 144–145binding numeric column to, 145–147DataGridViewTextBoxColumn in, 249–250as default control type, 190icon, 191overview of, 581setting data bindings, 93–96using data-binding expressions in, 497in WinFx applications, 530–531, 535in XAML, 540
TextChanged event, 101TextReader, 664–665Textual controls, 413–414Third-party components
adding control to Visual Studio Toolbox, 199
adding outside data source, 202designing own data-bound controls from,
21working with in Toolbox, 555–557
This property, IDataErrorInfo, 331This property, IList, 299ThreeState property, CheckBox controls,
580–581
Noyes.book Page 692 Thursday, December 15, 2005 3:57 PM
INDEX 693
ThreeState property, DataGridViewCheck-BoxColumn, 251
Tiers, layers vs., 23–26Toolbox, Visual Studio
adding custom controls to, 350–352creating Windows Forms, 555–557customizing, 199–200
ToolStrip controladding with designer, 212–213adding with Search Criteria Builder dialog,
212BindingNavigator control as version of, 103overview of, 598–600
ToolTipText property, DataGridViewCell, 245ToolTipText property, DataGridView-
Column, 248ToString method, ListBox control, 582–583ToString method, overriding, 413–414Transacted object editing, 416–420, 439–441Transactions
adding support to table adapters, 62–66client-side, 650–651overriding to add sorting to collection,
432–433scoping with System.Transactions, 647–649working with in ADO.NET, 643–647
TransactionScope class, 62, 648–649TreeView control, 518, 585try-catch block, 645–646try-finally block, 620, 646–648TryParse method, 103Two-way data binding, 82–83Type conversions
automatic formatting and parsing, 147–148binding events vs., 148–154overview of, 138–139
Type-safe indexer, 37–38Type safety, 34–37Typed data sets, 31–52
creating, 41–42creating with command line tools, 77–78creating with Data Set Designer, 42–49designer-generated code files for, 203displaying in Data Source window, 189filling and updating with table adapter,
56–58generated code, 49–52generating table adapters. See Table
adaptersinternals of, 37–41
review of, 31–34safety of, 34–37using in code, 78–79
TypeInfo, data source files, 203–204TypeName property, ObjectDataSource con-
trol, 506TypeUISetting, data source files, 204
UUnbound columns, 226–232
adding to grids, 264–265defined, 218, 227generating computed columns, 232overview of, 226–227using CellFormatting event, 227–231using RowsAdded event, 231–232
Unchanged method, client-side transactions, 650–651
Update method, data sets, 33Update method, table adapters, 54UpdateCoordinates method, bar chart con-
trols, 384UpdateDataBinding method, data-bound
custom controls, 387–389, 396Updates
ADO.NET, handling concurrency during, 628–631
ADO.NET, stored procedures, 632–637ADO.NET, with data sets, 624–628coordinates on bar chart controls, 384data bindings on data-bound custom
controls, 387–389, 396of data sources, 106–108to parent data-bound controls, 168–172typed data sets with table adapters, 56–58
Use Windows Authentication, 8–9UserControl base class, 586–588UserControl class, 569Users, validation, 457using block, 620, 646–648using statement, 78–79
VVal property, virtual mode, 237–238Validate method, 463ValidateChildren method
using AutoValidate property, 472validation down control hierarchy, 473validation up control hierarchy, 463
Noyes.book Page 693 Thursday, December 15, 2005 3:57 PM
INDEX694
Validated eventsDataGridView, 462–463defined, 459overview of, 459–461setting error provider message in response
to, 465Validation, 457–485
calling EndEdit and, 158capturing data errors on data sets, 475–479data concurrency resolution, 483–484DataGridView DataError event, 468–471DataGridView error displays, 467–468DataGridView events, 462–463down control hierarchy, 472–473ErrorProvider control and, 464–467for extended controls, 474–475handling events, 459–462IDataErrorInfo and, 479–482overview of, 479–482up control hierarchy, 463updating data sources, 107–108using AutoValidate property, 471–472Windows Forms, 458–459
ValidationConstraints enumeration values, 473
Value property, ConvertEventArgs, 149–150, 156
Value property, DataGridViewCell, 245ValueChanged event, DateTimePicker, 582ValueMember property, ComboBox control,
85–86, 88–90ValueMember property, DataGridCombo-
BoxColumn, 254ValueType property, DataGridViewColumn,
248Vector graphics, WinFx, 523View Code, 526Views
basing table adapters on, 67–69binding to data table really binding to data,
113typed datasets defining, 33
ViewState, 495–496Virtual mode, DataGridView, 233–241
choosing data sets or custom collections, 237–238
defined, 218initializing grid, 238–239overview of, 233–234
setting up, 234–237summary, 240–241understanding, 239–240
Visible property, DataGridViewCell, 245Visible property, DataGridViewColumn, 248Visual Studio 2005, 4–8Visual Studio Designer
defining grids, 263–266design-time declarative programming, 378designer-generated code, 563–566initialization, 334–337, 359–360
Visual Studio Designer, bound controls, 177–216
adding data sources, 179–180adding database data source, 181–185adding object data source, 186–189adding Web service data source, 185–186choosing data source type, 180code, 202–205customizing, 196–199from data sources, 189–196data sources files, 202–205with Data Sources window, 177–179generating data-binding code for existing
controls, 199–201generating other data-binding code,
205–206master-details bound controls, 214–216Properties window settings, 206–210selecting type, 196summary, 216using smart tags, 210–214
Visual Studio Options dialog, 197–198Visual Studio, Windows Forms applications,
554–563adding members to form, 557–561creating empty project, 554hooking up event handler and data
binding, 561–563working with Toolbox, 555–557
WWeb reference folder, 202–203Web reference icon, 191Web servers, validation controls, 483–484Web service data sources, 185–186, 202–203Weinhardt, Michael, 475WHERE clause, SqlDataSource control, 515Width property, DataGridViewColumn, 248
Noyes.book Page 694 Thursday, December 15, 2005 3:57 PM
INDEX 695
WindowLoaded event handler, XAML, 540–541
Windows class, WinFx, 527, 539–540Windows Communication Foundation
(Indigo), 521Windows Forms applications, building
data-boundadding new data sources and data
connection, 6–8creating project, 4–5customizing data source control mappings,
10–11data binding, 2–3data-bound controls, 20–21data objects and collections, 16–18data sets, 18–20data sources, 15–16generating data-bound controls, 11–12layered application architecture, 21–27overview of, 3–4running, 13–14selecting data objects, 8–10smart clients, 27–28
Windows Forms applications, programming, 547–600
architecture, 567–570binding data reader to, 607commanding and controlling, 598–600containing forms with parent forms,
577–578creating custom user control, 586–588data application in, 548–554data binding improvements in, 3data sources in, 16designer-generated code, 563–566displaying other forms, 576–577handling control events, 574–576layout of, 589–596main method, 570–574overview of, 547–548tab order settings, 597–598
Windows Forms, data display controls, 578–586
Button, 580CheckBox, 580–581ComboBox, 584DataGrid, 585–586DataGridView, 586DateTimePicker, 582label, 579–580
ListBox, 582–584ListView, 584overview of, 578–579PictureBox, 585RadioButton, 581RichTextBox, 582TextBox, 581TreeView, 585
Windows Forms Programming in C# (Sells), 378Windows Forms validation, 458–459Windows Forms, with Visual Studio, 554–563
adding members to form, 557–561creating empty project, 554hooking up event handler and data
binding, 561–563working with Toolbox, 555–557
Windows Presentation Foundation (WPF), 521
WinFx applications, 521–545binding collection to grid with templates,
541–543control styling in, 543–545data binding, 532–535data contexts and data sources, 536overview of, 521–522UP programming and capabilities, 522–525writing, 525–531XAML and, 537–541
WithEvents keyword, 576WPF (Windows Presentation Foundation),
521WriteXML method, 609–611.wsc file, 203
XXAML (Extensible Application Markup Lan-
guage)binding collection to grid with templates,
541–543control styling in WinFx, 543–545overview of, 537–541programming WinFx applications, 524–525
XDR (XML Data Reduced) schemas, 78XML data access, ADO.NET, 659–663
loading data into XPathDocument, 664–665navigating XML document, 667–669overview of, 658–659querying XML data, 665–667XmlDataDocument class, 659–663XPathDocument class, 663–664
Noyes.book Page 695 Thursday, December 15, 2005 3:57 PM
INDEX696
XML Data Reduced (XDR) schemas, 78XML, data source files, 202–205XML Schema Support utility (xsd.exe), 77–78XmlDataDocument class
defined, 658obtaining XPathNavigator for, 664searching data sets with, 638working with, 659–663
XMLDataSource control, 507–508, 518XmlDocument class
defined, 658navigating, 667–669obtaining XPathNavigator for, 664XmlDataDocument deriving from, 659
XmlReader class, 659, 664–665XmlWriter class, 659XPathDocument class, 663–665XPathNavigator
navigating XML documents, 667–669obtaining for XPathDocument, 664querying XML data, 665–667
XPathNodeIterator class, 666–667.xsc file, 204–205XSD (XML Schema Definition file)
configuring data source, 184converting XDR schemas to, 78creating typed data sets with, 42typed data set-generated code and, 49–50
Noyes.book Page 696 Thursday, December 15, 2005 3:57 PM