This is in VC++.NET. I dynamically create the number of buttons the user specifies. I add these buttons to an Arraylist. The buttons names goes from b1 ..bn where n is the max num of buttons. The user will provide me the button number and the text to be added to the button. How do I search the arraylist to find the button that the user wants? Thanks.

Lets say the buttons are b1 through b10. Will these be in order? If so. then this is rather easy. Your index values will be 0-9 or buttonN -1. So, when the user asks for a particular button, i.e. button 4 should have text ..., then you just need to take the input (4), subtract 1 and use this as the index for your array. Hope this helps.

Thanks for the tip. That's exactly what I need. Don't know what I was thinking.

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.