Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calculated field

2 views
Skip to first unread message

John

unread,
Oct 13, 2008, 9:13:02 AM10/13/08
to
Hi

I have a bond fields database winform app. How can I calculate a field form
one of the bound fields and show on form?

Thanks

Regards


Cor Ligthert[MVP]

unread,
Oct 14, 2008, 2:57:22 AM10/14/08
to
John,

I am an expert in cryptic answers, however in this case you are an expert in
my idea in cryptic questions.

Cor

"John" <in...@nospam.infovis.co.uk> schreef in bericht
news:O3RkoVTL...@TK2MSFTNGP06.phx.gbl...

John

unread,
Oct 14, 2008, 5:17:15 AM10/14/08
to
I have a bound form...Ok?

However..one of the field does not need to be bound instead calculated from
one of the bound fields...how to do it?

Let's say DOB is coming from a bound field? How to setup a Age field which
calculates from DOB?

Regards

"Cor Ligthert[MVP]" <notmyfi...@planet.nl> wrote in message
news:%23g06Fnc...@TK2MSFTNGP06.phx.gbl...

Cor Ligthert[MVP]

unread,
Oct 14, 2008, 6:32:08 AM10/14/08
to
This tip is not completely the same, however, you can do this normally using
the currency events

http://www.vb-tips.com/DataBindingEvents.aspx

Cor


"John" <in...@nospam.infovis.co.uk> schreef in bericht

news:eQvRn2dL...@TK2MSFTNGP04.phx.gbl...

William Stacey

unread,
Oct 14, 2008, 1:17:43 PM10/14/08
to
If your class is custom, (i.e. not generated from entity model), a simple
method is to add a readonly property to the class and put custom code in the
getter. I just run into this myself with Format event not firing on a
binding and can not figure out why (inside the new datarepeater control).
So I used a calculated property instead and bind to that. Works well and
imo is cleaner.

"John" <in...@nospam.infovis.co.uk> wrote in message
news:eQvRn2dL...@TK2MSFTNGP04.phx.gbl...

Steve Gerrard

unread,
Oct 14, 2008, 8:48:36 PM10/14/08
to
John wrote:
> I have a bound form...Ok?
>
> However..one of the field does not need to be bound instead
> calculated from one of the bound fields...how to do it?
>
> Let's say DOB is coming from a bound field? How to setup a Age field
> which calculates from DOB?
>

If you are binding to a datatable, you can add a calculated column to the table,
and then bind a form control to the calculated column. Lookup
DataColumn.Expression to see what kind of calculations you can do, and what the
syntax is. Age is not a great example, by the way, since it changes every second
(and always in the direction of older, dang it all).


Cor Ligthert[MVP]

unread,
Oct 15, 2008, 4:12:12 AM10/15/08
to
Steve,

You are right, in my opinion the best solution too.

Cor

"Steve Gerrard" <mynam...@comcast.net> schreef in bericht
news:RvKdnZKW5OREoGjV...@comcast.com...

0 new messages