
Signature
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Show me your certification without works,
and I'll show my certification
*by* my works.
Since I've been dragging and dropping, I don't exactly have a
currencyValue... If I examine the properties for the control, say,
currencyTextBox, in the .Text property I see that there is a little icon,
which states that the value for the control comes from
"tblClientsBindingSource - curIncome" where curIncome is a money typed field
in the table tblClients.
Furthermore, will the .ToString work for propagating data back into the
table as a currency value? Thanks again,
Matt
> currencyValue.ToString("C2")
>
[quoted text clipped - 17 lines]
> >
> > Matt
Kevin Spencer - 30 Mar 2006 13:31 GMT
Hi Matt,
> Since I've been dragging and dropping, I don't exactly have a
> currencyValue...
Actually, since you've been dragging and dropping, and don't know how to
format the bound text box, what you don't have is a very good understanding
of what all that dragging and dropping actually does. In order to do the
kind of tweaking that you're talking about, you need to gain some
understanding of what Visual Studio has been doing for you, and behind your
back.
The first thing to understand is that all that dragging and dropping does is
to write code for you which you could write for yourself if you had more
time. The good thing about this is, you can also change that code. But
first, you need to know what that code is, and how it works. It is important
to understand that GUI tools are not a substitute for knowledge. They are
productivity tools, built to enable you to write your own code faster. They
can rough out some quick and dirty (but solid) code for you, and you have to
take over from there. In other words, it's time to roll up your sleeves and
do some homework!
Unfortunately, "dragging and dropping" doesn't tell me much about what
exactly you've done, nor what you've created. There are quite a few things
that can be done with data using Visual Studio's GUI tools. And since I
don't know what you've done, I don't know what you're looking at, and I
can't really go much further at this point than that. If I did know
something about what you're working with, in terms of code, I could help
out.

Signature
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Show me your certification without works,
and I'll show my certification
*by* my works.
> Since I've been dragging and dropping, I don't exactly have a
> currencyValue... If I examine the properties for the control, say,
[quoted text clipped - 34 lines]
>> >
>> > Matt
jimmy - 30 Mar 2006 16:58 GMT
martin,
you're looking for the format and parse events of the binding object...
the format event handles formatting the data that is about to be put
into the text box, and parse takes the information from the text box
and stuffs it back the datasource. unfortunately, i've looked
everywhere and don't see someplace to specify their behavior at design
time. which i'm finding very disappointing (i am looking at vs 2003
however)
with that said, i'll show you some code that hopefully will get you
started on the right track. i'm just taking a stab at this one without
actually compilling it in VS, so let me know how it goes.
in the constructor for your form, try doing something like this:
Binding b = textBox.databindings["Text"]
b.Format += new ConvertEventHandler(this.currencyTextBox_Format)
b.Parse += new ConvertEventHandler(this.currencyTextBox_Parse)
then create the methods
private void currencyTextBox_Format(object sender, ConvertEventArgs e)
{
e.value = e.value.toString("C2")
}
(something similar for parse if needed)...