fguihen Posted December 8, 2005 Posted December 8, 2005 i have to create a number of objects. they could be forms or any object really, but i want to know is how do i create a new object when a user clicks a button? the user could click the button many times, creating many objects, and i dont want to limit the user by only declaring a set number of objects Quote
Diesel Posted December 8, 2005 Posted December 8, 2005 As far as I know, all objects are created at runtime. I don't believe there is a piece of software that can manipulate data before it is run. Ok, past the sarcasm, Im going to assume 1. you know what you are talking about and 2. you don't know the type of the object you want to instantiate... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemactivatorclasscreateinstancetopic.asp Quote
GMan_NC Posted December 8, 2005 Posted December 8, 2005 Here's an example of creating a form from scratch and adding a textbox to the form Dim frm As New Form frm.Name = "frmCreated" frm.Text = "Created Form" Dim tb As New TextBox tb.Name = "tbTest" frm.Controls.Add(tb) frm.Show() Of course you can set other properties of the form and textbox such as size, location, borderstyle, etc. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.