View Single Post
Old 04-26-2013, 11:43 AM
AtmaWeapon's Avatar
AtmaWeapon AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500

First, don't ever use "+" to combine strings. Use "&". Depending on circumstances, "+" will sometimes interpret the strings as numbers and perform addition. (I doubt this is the problem.)

Second, how sure are you that Address contains "1", with no spaces or other characters? Have you verified this in a debugger?

Third, have you considered using a control array? It's easier to debug and more elegant, in my opinion.

If I were forced to write this code, it would look like this:
Dim textBoxId As String = String.Format("TextBox{0}", Address)
Dim candidates() As Control = Me.Controls.Find(textBoxId, True)
candidates(0).Text = "0"
Using more variables makes things easier to debug. It's rarely a bad idea.
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote