Visual Studio .NET - How to Get Dynamic Controls ID

Asked By rama chandran on 15-Mar-13 08:04 AM
Hi Friends,

i am developing 1 application using windows application code behind VB only. i need the code for the below requirement.

1) I created 1 form and kept 1 button, 2 textboxes.
2) when entered the numbers in textboxes and clicked on the button, it will create the labels and textboxes controls dynamically in new form also 1 button will also creates in that new form.
3) but now i want to get the ID for that dynamic controls like labels, textboxes and button that created in the new form.
4) and i want to write some functionality inside the new button, means when click on that button i want to get the IDs and values of that controls. so how to do this pls help me.

so please send me the full code for this.


Regards.
Ram


Robbe Morris replied to rama chandran on 15-Mar-13 08:58 AM
Use a Panel control and add your TextBox, ListBox, etc. controls to its. .Controls collection.  Prior to adding the control, wire up its event handlers.  You can cast the "object"/send argument of the event handler to the control that raised the event and get its ID.  Then, react accordingly.
rama chandran replied to Robbe Morris on 15-Mar-13 09:13 AM
thanks but i am new to this so can you please send me the code, becoz i am dont have that much knowledge abt .Net.
so that it will be useful for me.
Robbe Morris replied to rama chandran on 15-Mar-13 09:15 AM
Sorry, don't have time to do your work for you.  Use the intellisense in Visual Studio to help get you started.