Hi

I am woundering if anyone can help me please. I have a form that has been created during runtime. I can get the name of one control in the collection and want to access a number of other controls that relate to this, they all have a common denominator, a number added to a standard name.

Is there anyway to access these controls without continually iterating through the controls collection?

Thanks

You could use :

if ( Myform.Controls.Contains(MyButtonNr1)
{
  //do something
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.