bindingsource

How to fix no-sorting error on DataGridView?

I have a DataGridView that is bound to BindingSource and it's DataSource is DataView and this DataView has a DataTable bound. But when I call DataGridView.Sort(Column, Ascending) On a column that exists in DGV and in DT I get error: DataGridView control cannot be sorted if it is bound to an IBindingList that does not support sorting...

Reflect underlying data changes in bounded WinForms controls.

Hi. I have scenerio like this: I have a BindingSource, typed DataSet and a ComboBox which property SelectedValue is bound to the BindingSource. On my form a have various controls but I guess the rule working for ComboBox will be applicable to the rest controls so I am describing a simplified scenerio. To insert a new empty row I run t...

Using a BindingSource, how do I tell if I have changes pending?

I am using a BindingSource in a WinForms project that edits a simple table on a SQL server. I want the "Save" icon to light up when the user tabs off a field if he has changed it. I have tried the HasChanges() method of the DataSet, but this returns false after I have made a change. How do I tell if the user has changed something? ...

Access bindingsource column value

How can I update a column value in a binding source with code? I am trying for something similar to this: CustomersBindingSource.AddNew(); CustomersBindingSource.Current["CustomerID"] = Guid.NewGuid(); This code currently errors stating: "Cannot apply indexing with [] to an expression of type 'object'". Any help re-writing this is g...

asp.net mvc model binding

Hi I am working with asp.net model binding, I have got it working previously with html forms, the problem here is the UI client is going to be a rich client. I have this controller action public ActionResult CreateUser(User profile) previously with html forms, as long as the form html input names matched the name of the properties of...

How do I find which rows have been updated in the underlying Datatable on updating the Datagridview?

This is what I am trying to achieve : 1)DataTable populated using data from non database source 2)This table is bound to a DataGridView using BindingSource 3)The DataGridView is updated by the user, so that some cells now have new values. 4)Because the table is bound to the datagridview its values are updated. How do i get only the updat...

c# bindingsource and linq

Hi all, I have a bindingsource which has been filled out by tableadapter.fill(DS, param1); lets say that this bindingsource has : char num A 1 B 2 C 3 how do I get num value with given char 'A' using linq? I could literate using foreach (DataRowView data in this.p_EM_Select_Event_TypeBindingSource) but I would li...

The passed entity bound to my BindingSource is updated in realtime, how can I prevent that?

Hello, I have a Mainform + smallDialog. scenario: The Mainform has a datagrid with entities bound. The smallDialog updates the entity double-clicked-on-the-datagrid-in-Mainform wich is passed to the smallDialog and bound there again to a bindingsource. When I change now some data in the textfiels AND leave the textfield so the focus...

I get a Argumentexception by binding a customer to a WinForms Bindingsource

Hello, I'm learning NHibernate with Fluenthibernate. I'm using it with C#, Winforms and BindingSource, and I get a Argumentexception by loading a Customer without orders. What can I do or what is wrong? Mapping: public class CustomerMap : ClassMap<Customer> { public CustomerMap() { Id(x => x.Id); HasMany(x => x....

Searching via DataTable.Select, BindingSource and foreach (C#, ADO.NET)

Hi, I have a DataTable X, if I now want to search for a certain entry, would it be faster/better to use BindingSource.Filter, X.Select() or just foreach? ...

Entity Framework filter nav property with Self Tracking Entities

I'm using Self Tracking Entities and have a scenario where I have an entity that represents a table that we'll call table A. A is a parent to another table B which is also represented as an entity. On my WinForm I have 3 different binding sources that each represent different types of records from table B but all are children of table A....

C# / .NET: Move to desired Item in BindingNavigator

I'm using such a BindingNavigator to let the User move through Data Records of a BindingSource. How can I change the displayed page to a desired page number through the program? I already set the PositionItem to the desired page number, but that just changes the displayed page number and doesnt move to this page. I'm sure it's not di...

Get the BindingSource position based on DataTable row

Hi. I have a datatable that contains the rows of a database table. This table has a primary key formed by 2 columns. The components are assigned this way: datatable -> bindingsource -> datagridview. What I want is to search a specific row (based on the primary key) to select it on the grid. I cant use the bindingsource.Find method becau...

Can a static property of a static class be a DataMember of a BindingSource?

I have static class that has a bunch of static properties. When I try to bind the property to a BindingSource (in the UI), I can pick the static class as the DataSource, however, when I drop down the DataMember combo, there is nothing there. Can I use a static property of a static class as a DataMember of a BindingSource? I should men...

Filtering at bindingsource doesn't work

I have textbox when I put phrase of description of task or id of task. I want to filter this list by text of this textbox. But when I put text into this textbox filtering doesn't work. Collection i datagridview doesn't change. What can be wrong ? public void BindData() { var emptyBindingSource = new BindingSource...

Sorting BindingSource using two different columns

Hi everyone! Im currently trying to fix some bugs in a system using C# in VS 2008. The problem goes as follows: The client wants some controls to be sorted. The form consists of four controls. Two of which are binded with BindingSourceA lets say and the other two with BindingSourceB. One of the controls binded with BindingSourceA dis...

How to configure a WCF client in code by using wsDualHttpBinding?

Hi. I saw this post with a proposed solution: http://stackoverflow.com/questions/497209/how-to-set-up-a-wcf-client-using-wsdualhttpbinding-in-code but is not clear me what it is refering to as the CommServiceClient when talking about creating a service client. Some example? ...

Filter rows in DataGridView bound to object collection

Hi, I need to filter what items from a collection object that I want to show in a DataGridView. It may be; ObjectModel.Collection, a BindingList or simply a List. I may use a BindingSource between the object and the DataGridView if that's an advantage. What different options do I have for filtering, while still maintaining two-way bin...

C# - 2 problems - referencing a cell in DataGridView_RowsAdded causes nullreference error; Cant update database with DataGridView data...

Hey, I just started writing a customer application in C#, using Visual Studio design mode for most of it. Bear in mind I only started learning C# yesterday - so if I am making any stupid mistakes then please say so. What I have so far A database; A DataSet which links to the Customer and Agent tables; A BindingSource which binds to t...