dotnetmonitor.com |
|
||||||||||||
| /*
Setup binding - bind to Hour */
/* Second would be a better choice but this provides a better example */ /* of the potential issues you can run into with multi-column binding */ this.textBox1.DataBindings.Add("Text", bo, "Hour", true);
/* Add formatting event */ Binding timeBinding = this.textBox1.DataBindings["Text"];
/* Concatenate Hour, Minute and Second properties on the data source */ timeBinding.Format += delegate(object binding, ConvertEventArgs args) { // Get the bound object BusObject bo = ((binding as Binding).BindingManagerBase.Current as BusObject);
if (null != bo) { args.Value = string.Format("{0:00}:{1:00}:{2:00}", bo.Hour, bo.Minute, bo.Second); } }; |
||||||||||||
|
||||||||||||