S
ShaneO
A VB.NET 2005 question -
For simplicity, if I have say, 20 TextBoxes and 15 Labels on a Form that
regularly require clearing (ie. "") or setting to the same value (eg.
"---"), would it be frowned upon to use the following code -
Dim sStr as String = "" '(or "---")
Dim Txt As Object
Dim TxtArray As Object() = {TextBox1, TextBox2,.. Label1, Label2,..}
For Each Txt In TxtArray
Txt.Text = sStr
Next
or should I separate the two Object Types such as -
Dim TextBoxArray As Object() = {TextBox1, TextBox2,..}
Dim LabelArray As Object() = {Label1, Label2,..}
and then iterate through different For Each..Next loops
- or -
don't do any of the above and explicitly assign the Text value of each
Object such as -
Dim sStr as String = "" '(or "---")
TextBox1.Text = sStr: TextBox2.Text = sStr...
Label1.Text = sStr: Label2.Text = sStr...
I'd be interested to read your comments or suggestions and information
on how others would address this one.
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.
For simplicity, if I have say, 20 TextBoxes and 15 Labels on a Form that
regularly require clearing (ie. "") or setting to the same value (eg.
"---"), would it be frowned upon to use the following code -
Dim sStr as String = "" '(or "---")
Dim Txt As Object
Dim TxtArray As Object() = {TextBox1, TextBox2,.. Label1, Label2,..}
For Each Txt In TxtArray
Txt.Text = sStr
Next
or should I separate the two Object Types such as -
Dim TextBoxArray As Object() = {TextBox1, TextBox2,..}
Dim LabelArray As Object() = {Label1, Label2,..}
and then iterate through different For Each..Next loops
- or -
don't do any of the above and explicitly assign the Text value of each
Object such as -
Dim sStr as String = "" '(or "---")
TextBox1.Text = sStr: TextBox2.Text = sStr...
Label1.Text = sStr: Label2.Text = sStr...
I'd be interested to read your comments or suggestions and information
on how others would address this one.
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.