Re: DataBinding.Format still the only way to format Textbox text?

Fabian Schmied <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <[email protected]>
> I'm coming back to winforms after a long hiatus, and now doing 2.0.
> Back in the 1.1 days if I bound a Textbox.Text property to a DateTime &
> I didn't want the time portion displayed, I'd have to handle the
> appropriate DataBinding.Format event.  Is that still the case in 2.0, or
> is there some new cool way of specifying a display/input format for
> that?

I'm no expert on data binding, but a quick experiment yielded the following:

Binding binding = new Binding ("Text", _source, "DateTimeMember");
binding.FormattingEnabled = true;
binding.FormatString = "d";
textBox1.DataBindings.Add (binding);

(There's also a Format event on the Binding class.)

Regards,
Fabian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.