Can you elaborate a little bit more?
I have
1) created a .Net 2TestCustomControl in VS2005
2) Dragged a Label into the Component designer
3) Dragged a Textbox into the Component designer
What I want is to be able to do something like
MyTestControl.DataBinding.Add("Text",myDataTable["myTable"],"myField");
And for the CustomControls Label.Text and TextBox.DataBindings to be updated
automatically.
What code do I have to write within the Custom Control to achieve this?
> Hi Patrick,
>
[quoted text clipped - 11 lines]
> P> to hard-wire the Label.Text for each Label for textbox?
> P>
Alex Meleta - 31 Aug 2007 16:11 GMT
Hi Patrick,
If you override Text propery of user control (or create another property)
you can put the code to update other controls. Or create two properties for
both databindings.
P> And for the CustomControls Label.Text and TextBox.DataBindings to be
P> updated automatically.
But, do you want to update other bindings by setting only one?
Regards, Alex
[TechBlog] http://devkids.blogspot.com
P> Can you elaborate a little bit more?
P>
P> I have
P> 1) created a .Net 2TestCustomControl in VS2005
P> 2) Dragged a Label into the Component designer
P> 3) Dragged a Textbox into the Component designer
P> What I want is to be able to do something like
P> MyTestControl.DataBinding.Add("Text",myDataTable["myTable"],"myField"
P> );
P> And for the CustomControls Label.Text and TextBox.DataBindings to be
P> updated automatically.
P>
P> What code do I have to write within the Custom Control to achieve
P> this?
P>
P> "Alex Meleta" wrote:
P>
>> Hi Patrick,
>>
[quoted text clipped - 12 lines]
>> P> to hard-wire the Label.Text for each Label for textbox?
>> P>
Patrick - 31 Aug 2007 17:24 GMT
Where (within the CustomControl) should code to wire up base on the Custom
Property for the Label.Text and TextBox.DataBindings be inserted?
> Hi Patrick,
>
[quoted text clipped - 42 lines]
> >> P> to hard-wire the Label.Text for each Label for textbox?
> >> P>
Alex Meleta - 31 Aug 2007 19:27 GMT
Hi Patrick,
Anywhere add something like.. this (as example):
public void ApplyBinding(DataSet dataSet)
{
DataBindings.Add("TextBox", dataSet, "Table1.Column1");
DataBindings.Add("TextLabel", dataSet, "Table1.Column2");
}, where TextBox and TextLabel are properties onto edit box and label.
Certain example depends on real needs.
Regards, Alex
[TechBlog] http://devkids.blogspot.com
> Where (within the CustomControl) should code to wire up base on the
> Custom Property for the Label.Text and TextBox.DataBindings be
[quoted text clipped - 49 lines]
>>>> P> to hard-wire the Label.Text for each Label for textbox?
>>>> P