Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

Browse by Tags

All Tags » Data Access » Data Binding (RSS)

Sorry, but there are no more tags available to filter with.

  • What is INotifyPropertyChanged?

    Business objects and controls do not have a generic way to provide notification when a property changes. The current convention is to provide a property changed event for each property (e.g. "PropertyName"Changed event handler). For business...
  • What is BindingList<T>?

    The fundamental two-way binding interface in the .NET Framework is IBindingList. The IBindingList interface is required for two way data binding and implemented by data access layers such as ADO.NET. In VS 2005, we have implemented a concrete, generic...
  • What is a BindingNavigator?

    The BindingNavigator control represents a standardized way to navigate data on a form. When a BindingNavigator is connected to a BindingSource it can be used to navigate through the rows of the BindingSource's (the rows of the BindingSources'...
  • What is a BindingSource and why do I need it?

    The BindingSource component provides a layer of indirection between the underlying data source and the bound UI controls. The usage pattern for BindingSource is for it to be bound to the data source and for the UI controls to be bound to the BindingSource...
  • Why doesn't my DataGrid control stay in sync with my TextBox Control?

    When two controls using the same data source are not synchronized, it is because they are using different CurrencyManagers. There are two common ways in which controls bound to the same data source have different CurrencyManagers: the first is they have...
  • How can I use simple binding to display multiple data source properties?

    Simple binding does not directly support data source property concatenation however you can use the Binding Format event to concatenate multiple data source properties. To do this you need to add a Binding to the primary property (or one of the data source...
  • Why doesn't DataSourceUpdateMode.OnPropertyChanged work for ADO.NET data sources?

    When binding to ADO.NET tables using simple list binding , the Windows Forms runtime binds to an instance of an ADO.NET DataRowView. The DataRowView supports row level commit semantics via an interface called IEditableObject (see the IEditableObject section...
  • How can I get a CheckBox control to immediately update the data source when its value changes?

    By default, simple binding updates a bound data source property value as part of Control validation. Control validation occurs when a Control loses focus (see Controlling the Binding Operation for more information). In VS 2005, a new property named DataSourceUpdateMode...
  • Why can't I close my Form when using Data Binding?

    By default, simple binding updates a bound data source property value as part of Control validation. Control validation occurs when a Control loses focus (see Controlling the Binding Operation for more information). Validation also occurs when a Form...
  • Why can't I Tab out of my Control when using data binding?

    By default, simple binding updates a bound data source property value as part of Control validation. Control validation occurs when a Control loses focus which occurs when a user Tabs or Clicks off a Control (see Controlling the Binding Operation for...
  • What is Change Notification and why is it important?

    The single most important concept to understand about Windows Forms data binding is that it is driven off of change notification. What this means is that Windows Forms will not update a user interface element (Control) unless that data source notifies...
  • How can I control the binding operation?

    The Windows Forms simple binding type (System.Windows.Forms.Binding) allows developers to control how and when a change to user interface element updates a bound data source property as well as how and when a change to a data source property updates the...
  • What is BindingContext?

    When using simple list binding (see Simple List Binding ) the simple bound control needs to synchronize to the "current item" of its data source. In order to do this, the binding needs to get the "Current" item for the CurrencyManager...
  • What is currency management?

    One of the most important services provided by Windows Forms data binding is currency management. In the context of Windows Forms data binding, currency does not have any monetary connotations; rather it refers to maintaining and synchronizing a "current...
  • How does error handling work with data binding?

    Windows Forms data binding integrates with the Windows Forms ErrorProvider control. When using the ErrorProvider and if a simple data binding operation fails, the ErrorProvider control will provide visual feedback (an error icon) on the user interface...
  • How does formatting work with data binding?

    Windows Forms binding supports formatting of the target data using .NET framework format strings. For example, when binding a Decimal property on a business object (e.g. Order.Total) to a string property on a Control (e.g. TextBox.Text) a format string...
  • How does type conversion work with data binding?

    If required, Windows Forms will perform type conversion as part of the binding process. For example, if an integer property on a business object (e.g. Customer.ID) is bound to a string property on a Control (e.g. TextBox.Text) the data binding runtime...
  • What is Data Binding?

    From a Windows Forms perspective, "Data Binding" is a general mechanism to bind data to a user interface element (Control). There are two broad types of data binding in windows forms: simple and complex . Simple Binding Simple binding is a general...
  • How do I programmatically move through a DataSet that has bound controls?

    You have to access a property called the Binding Context and then retrieve the BindingContext associated with the DataSet and data member that you used for binding. After you have access to this object you just set the position property. You can move...
  • How do I bind a control to an ArrayList so that changes are shown correctly?

    I am binding a ListBox to an ArrayList. The initial display is okay, but changes to the ArrayList are not shown in the ListBox. How can I get the changes to show properly? In an ArrayList, the "plumbing" is not available to support two-way binding...
  • How do I ensure that programmatic changes to the value of a bound control get updated in the DataSource?

    I programmatically change a bound TextBox value, but the value does not get pushed back into the bound DataSource. How can I make sure the DataSource is updated? Call the EndCurrentEdit method on the BindingManager for the control. Here is an example...
  • Why am I getting the error message "This would cause two bindings in the collection to bind to the same property"?

    As the error message suggests, the code is calling Control.DataBindings.Add twice with what amounts to the same parameters. One way this might happen is if you call the same code more than once in your program to reload your data source for some reason...
  • How do I bind two controls to the same DataTable without having changes in one control also change the other control?

    When I try to bind two ComboBoxes to the same DataTable, both ComboBoxes show the same values, changing one changes the other. How do I make them have distinct values? Use different BindngContext objects for the two ComboBoxes as shown here. comboBox1...
  • How do I prevent two controls bound to the same DataTable from sharing the same current position?

    If you have two controls bound to the same data source, and you do not want them to share the same position, then you must make sure that the BindingContext member of one control differs from the BindingContext member of the other control. If they have...
  • Where can I find a discussion of data binding and Windows Forms?

    Take a look at the Microsoft KB article, INFO: Roadmap for Windows Forms Data Binding (Article ID 313482) in the Microsoft Knowledge Base. This article will get you started, and also lists a number of articles related to data binding and the DataGrid...
  • How do I bind data from an MDB file to a control?

    Use the classes in the System.Data.OleDb namespace to read an MDB file into a DataSet, then bind the DataSet to one or more controls like ListBox and a ComboBox. First you instantiate a OleDbConnection object using a connection string to your MDB file...
  • Does data binding work with a Nullable<DateTime> property?

    Having a control with a property of Nullable<DateTime> type, is simple data binding supported against it? Is it supported at the IDE level? Is the data binding framework smart enough to map it to a nullable DateTime column on a database? Yes - this...
  • Why are changes not preserved into the database when the Form is closed?

    I have a Form and some controls bound to DataConnector. I have to scroll through the records update a few but when I close the form, all my changes are lost. I have tried using the dataConnector.EndEdit() but it doesn't do anything. How do you update...
  • How do I get DataConnector to use an IList for a data source?

    How do I get DataConnector to use an IList for a data source? I'm trying to get a DataConnector component to recognize that my data source implements IList. According to the documentation, it should then use this implementation instead of its own...


Page view counter