If you don't mind, let's call the above your interpretation of how my idea would be implemented, but it's nothing like how I would do it, because it's wasteful to iterate over every control on the form many times, once for each button. Your interpretation also tests to see if the entire name of a button is contained in the name of a ComboBox, which according to the OP's description, won't work because the button names start with 'btn', and the combobox names start with 'cb'. You also have to cast the Tag property to a ComboBox (and not assume that the value is assigned to a ComboBox) before you can use it as one.
Call it whatever you want. Really all I was trying to convey to the OP about your idea was Button.Tag = Combobox... Button.Tag.Visible = True, which
was your idea but you provided no code. Also
you are assuming the tag on a button
could be someting other than a combo box. You most certainly do not "have to" cast it to a combo box if thats all youre using the tags for. Furthermore I stated that he would have to use an appropriate naming theme for my code to work. He gets the point. I trust he can use string functions to suit his specific needs.
I predicted you wouldn't like either example which is why I specifically stated that they were not optimal. Clearly the OP is novice (so am I) or he wouldnt be asking such a question. He just needed some code to get his gears turning. I also pointed out that a custom class would be the "correct" way to do things.
Pointing out the obvious (restating what I have already said even), can be misinterpreted as something else. There is no need to check if the combobox is null in your last example, because you wouldnt create an instance of the class if it was. Anyone can nitpick
example code, but it's not always welcome or necessary.