Re: Why can't I bind to count property of a dataview?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Derek Chong (dchong_at_landfood.unimelb.edu.au)
Date: 05/14/04


Date: Fri, 14 May 2004 16:01:50 +1000

Have given up trying to bind to the DefaultView.count property, I was
hoping just something simple like lblLabel.Databindings.Add("Text",
DataTable.DefaultView, "Count") would work but alas all is not that easy in
the .Net world.

All I was after was an easy way to show users how many rows were displayed
in a datagrid by reporting on the underlying defaultview. I have ended up
using the DefalutView.ListChanged event to update the count lable instead.

Cheers
Derek
"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:%23UM6gKSOEHA.3124@TK2MSFTNGP12.phx.gbl...
> Derek, if I understand you correctly, no you can't do it You can though
> set it when the filter on the table changes which logically makes more
> sense. You see, if I bound to count and changed the filter, the number
> would change but have nothing to do with the position that the binding
uses.
> You'd probably want to to change based on the filter changing or use a
> computed column with DataTable.Compute and set the value to it.
>
> HTH,
>
> Bill
>
> www.devbuzz.com
> www.knowdotnet.com
>
> "Derek Chong" <dchong@landfood.unimelb.edu.au> wrote in message
> news:OCNn0FIOEHA.2728@TK2MSFTNGP12.phx.gbl...
> > Hi,
> >
> > I am trying to add a databinding to a label that uses a tables
> > defaultview.count property. I keep getting an error message that says I
> > can't bind to it, is this by design or a bug?
> >
> > Any suggestions appreciated
> >
> > Derek
> >
> >
>
>



Relevant Pages

  • Re: Why cant I bind to count property of a dataview?
    ... Derek, if I understand you correctly, no you can't do it You can though ... You see, if I bound to count and changed the filter, the number ... > I am trying to add a databinding to a label that uses a tables ... I keep getting an error message that says I ...
    (microsoft.public.dotnet.framework.windowsforms.databinding)
  • Re: Basic Binding and Filtering Problem
    ... Access table called "DateTable" with a couple of datetime columns, ... If I access the data through a dataset, the grid and monthcalendar bind ... You can bind them all to a DataTable, all to a DataSet or all to a DataView. ... Controls and then filter that. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Amateur Scripter Question
    ... ' Bind to OU. ... ' Filter on user objects. ... ' Enumerate all users in the OU. ... Microsoft MVP Scripting and ADSI ...
    (microsoft.public.windows.server.scripting)
  • Re: Would an IM filter driver bind to a PPPoE running over USB
    ... Filter IM drivers bind according to a match between the IM driver's INF ... Some developers mistakenly set a miniport's LowerRange to ... Also depends how PPPoA represents itself at upper edge (usually they claim ...
    (microsoft.public.development.device.drivers)
  • Re: Basic Binding and Filtering Problem
    ... Access table called "DateTable" with a couple of datetime columns, ... textbox displays the data in the Synopsis column. ... If I access the data through a dataset, the grid and monthcalendar bind ... Controls and then filter that. ...
    (microsoft.public.dotnet.framework.adonet)