Questions tagged [bindingsource]

BindingSource is a .NET class that encapsulates the data source of a Windows form.

BindingSource is a .NET class that encapsulates the data source of a Windows form. A rough equivalent in the Java standard API might be RowSet.

682 questions
31
votes
3 answers

When is it worth using a BindingSource?

I think I understand well enough what the BindingSource class does - i.e. provide a layer of indirection between a data source and a UI control. It implements the IBindingList interface and therefore also provides support for sorting. And I've used…
Justin
  • 680
  • 9
  • 19
21
votes
2 answers

BindingSource - what are the advantages of using BindingSource

What gives me using something like this: DataGridView dgvDocuments = new DataGridView(); BindingSource bindingSource = new BindingSource(); DataTable dtDocuments; dtDocuments = MsSQL.GetDocuments(dtpOd.Value, dtpDo.Value); bindingSource.DataSource…
Adam Filipek
  • 213
  • 1
  • 2
  • 5
18
votes
6 answers

Can my binding source tell me if a change has occurred?

I have a BindingSource that I'm using in winforms data binding and I'd like to have some sort of prompt for when the user attempts to close the form after they've made changes to the data. A sort of "Are you sure you want to exit without saving…
Allen Rice
  • 19,068
  • 14
  • 83
  • 115
15
votes
5 answers

How do you get the proper mapping name from a binding source bound to a List, or an anonymous type, to use on a DataGridTableStyle?

I'm trying to create a DataGridTableStyle object so that I can control the column widths of a DataGrid. I've created a BindingSource object bound to a List. Actually it's bound to an anonymous type list created though Linq in the following manner…
Jason Down
  • 21,731
  • 12
  • 83
  • 117
15
votes
4 answers

Updating of BindingSource in WinForms does not update Datasource Collection

I want to display a custom collection in a DataGridView in a Windows Forms app. This custom collection implements ICollection, and IEnumerable. I have set up a BindingSource, using the collection as the .DataSource property. The DataGridView is…
Jeff Clare
  • 185
  • 1
  • 1
  • 8
15
votes
3 answers

What are the benefits of using a bindingsource with bindinglist as datasource?

I can directly bind my DataGridView control to a bindinglist of my business objects by setting the DataSource property. My business object implements INotifyPropertyChanged, so the DGV gets updated when a new item is added to the Binding List or…
user774062
  • 203
  • 1
  • 2
  • 8
13
votes
3 answers

C# (Visual studio): Correlation between database, dataset, binding source

I am just learning C# through Visual Studio 2008? I was wondering what exactly is the correlation between dabases, datasets and binding sources? As well, what is the function of the table adapter?
Northener
  • 863
  • 4
  • 9
  • 14
13
votes
2 answers

Do I need a BindingSource AND a BindingList for WinForms DataBinding?

I want to display a list of people in a DataGridView in a Windows Forms app. I want my service layer to return a list of Person objects (e.g., IList). I want changes in the list to be reflected in the DataGridView and vice versa. My…
User
  • 62,498
  • 72
  • 186
  • 247
10
votes
4 answers

Using a BindingSource in a UserControl

I have a UserControl with multiple fields that I would like to have bound to a BindingSource. I would also like the UserControl to expose some BindingSource property so that it can be dropped on a Form and be bound to the BindingSource on the form.…
Metro
  • 1,464
  • 14
  • 24
10
votes
3 answers

Can't refresh datagridview with bindingsource

Goal: Once clicking on add or delete button, the datagridview should be refreshed with the latest data from document. Problem: The datagridview can't be refreshed after making changes by deleting or adding new data. I'm using binding source…
HelloWorld1
  • 13,688
  • 28
  • 82
  • 145
9
votes
3 answers

.NET BindingSource Filter syntax reference

You can use the Filter property of a BindingSource to do SQL like filtering. For example: bindingSource.Filter= "Activated = 1" Is there something like documentation on the exact syntax of this? I would like to check if a field is not DBNull, so i…
clamp
  • 33,000
  • 75
  • 203
  • 299
8
votes
6 answers

Allow user to sort columns from a LINQ query in a DataGridView

I can't quite work out how to allow a DataGridView populated at runtime to sort (when users click on the column headers) where a LINQ from XML query is the DataSource, via a BindingSource. Dim QueryReOrder = From Q In Query _ …
user57087
  • 147
  • 2
  • 4
  • 9
8
votes
2 answers

When setting the DataSource property of an object, when do you use a Type vs. an instance?

Question What is the difference between setting a [...].DataSource to an instance of an object vs. the type of a class? I have seen both methods in use in our codebase, and I'm trying to wrap my head around why it is one way or the other in any of…
Jake Smith
  • 2,332
  • 1
  • 30
  • 68
8
votes
3 answers

Manual data binding using WriteValue

If I turn off automatic updating of a binding data source by setting DataSourceUpdateMode = Never and then use a button to update the whole lot (using binding.WriteValue), a problem occurs - Namely, only the first bound control's data source is…
Jules
  • 4,319
  • 3
  • 44
  • 72
8
votes
2 answers

BindingSource MoveFirst/MoveLast doesn't work

My winforms skills are a bit rusty. I'm using a BindingSource for a DataGridView. On KeyDown of the DataGridView i want to select the next/previous record which works as desired. I want to select the first if the user hits Keys.Down when the last…
Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
1
2 3
45 46