M
Michael Clarke
Hi everyone
I have just started using a common event handler with controls
by using the tag property of the control to store the index.
Now seeing the tag property is an object is there any more overhead involved
if I store my own personal object there?
That way if I ever need to evolve the tag capabilities it will be easier?
I know I can just store a string there ... anyway does anyone have some
better ideas?
I don't like the idea of having to create a new object though for each tag I
am so used
to OOP in VB classic!
private void InitialiseCustom()
{
System.EventHandler btnEh = new System.EventHandler(btnClick);
TagHandler th0 = new TagHandler(0,1001);
this.btn0.Click += btnEh;
this.btn0.Tag = th0;
TagHandler th1= new TagHandler(1,1002);
this.btn1.Click += btnEh;
this.btn1.Tag = th1;
System.EventHandler txtEh = new System.EventHandler(txtChanged);
TagHandler th2 = new TagHandler(0);
this.txt0.TextChanged += txtEh;
this.txt0.Tag = th2;
TagHandler th3 = new TagHandler(1);
this.txt1.TextChanged += txtEh;
this.txt1.Tag = th3;
}
I have just started using a common event handler with controls
by using the tag property of the control to store the index.
Now seeing the tag property is an object is there any more overhead involved
if I store my own personal object there?
That way if I ever need to evolve the tag capabilities it will be easier?
I know I can just store a string there ... anyway does anyone have some
better ideas?
I don't like the idea of having to create a new object though for each tag I
am so used
to OOP in VB classic!
private void InitialiseCustom()
{
System.EventHandler btnEh = new System.EventHandler(btnClick);
TagHandler th0 = new TagHandler(0,1001);
this.btn0.Click += btnEh;
this.btn0.Tag = th0;
TagHandler th1= new TagHandler(1,1002);
this.btn1.Click += btnEh;
this.btn1.Tag = th1;
System.EventHandler txtEh = new System.EventHandler(txtChanged);
TagHandler th2 = new TagHandler(0);
this.txt0.TextChanged += txtEh;
this.txt0.Tag = th2;
TagHandler th3 = new TagHandler(1);
this.txt1.TextChanged += txtEh;
this.txt1.Tag = th3;
}