Hi all!
...jup.. I'm back again..
This time I seem to have troubles with my array, I want it it to do a fairly easy job, but I can't figure out the syntax of how to do this.
I have a form with several sorted TextBoxes, named accordingly:
tb_dec[1-6]
tb_bin[1-6]
tb_hex[1-6]
This is a program I'm trying to make for fellowstudents who have problems with converting decimal <-> binairy <-> hexadecimal, and it's a great way for me to learn and practice (much more learning is involved then I had originally thought!)
So I created a button and added an event, and I know how to let it compare one field to another field and check if the solution is correct and to notify the user of that fact, but that is the hardcoded way... I'd like it to figure some stuff out for itself.
if (tb_dec#.Text == Convert.ToString(FromBin(tb_dec#.Text)))
{
(pb_dec#.Image = Properties.Resources.icon_correct;
}
else
{
(pb_dec#.Image = Properties.Resources.icon_incorrect;
}
The #'s are to indicate that it needs to go from the number 1 to the number 6 in accordance with the fieldnames.
Now I wanted to use an array for this, but then I hit trouble...
Every way imaginable to me failed at trying to construct that name in a way that C# would understand that it is still a control on my form. Each time it tells me that tb_dec or pb_dec doesn't exist, while leaving out my intended numbers...
(I can post screenshots of the exact problem if anybody would like)
Anybody have a clue or hint?
Thanks for reading all of this!