Tag property ?

  • Thread starter Thread starter john sutor
  • Start date Start date
J

john sutor

Can anyone show me an example of using the Tag property - besides the poor
example Microsoft has on MSDN.
How about using it with a text box
 
Hi John,
Can anyone show me an example of using the Tag property - besides the
poor example Microsoft has on MSDN.
How about using it with a text box

The Tag-Property gives you the opportunity to add an additional value you
can use later. For Example to read the values of all Textboxes into a
string-Array:

================
textBox1.Tag = 0;
textBox2.Tag = 1;
textBox3.Tag = 2;

private string[] GetTextValues() {

string[] result = new string[3];

foreach ( TextBox t in this.Controls ) {
int tagValue = (int)t.Tag;
result[tagValue] = t.Text;
}
return result;
}

===================

Regards,

Frank Eller
 
Back
Top