|
-
Sep 30th, 2003, 08:18 PM
#1
Thread Starter
Registered User
create text boxes at runtime
how can i create a textbox with a set position and size on a form at runtime?
thanks,
marvin
-
Sep 30th, 2003, 09:17 PM
#2
Frenzied Member
Very easy. It should be something like this:
VB Code:
Dim mytextbox as New TextBox
mytextbox.Size=New System.Drawing.Size(80, 16)
mytextbox.Location = New System.Drawing.Point(184, 4)
....' any other property goes here. [b]dont forget[/b] to add this textbox to form or whatever container you need.
Form1.Controls.Add(mytextbox)
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Oct 1st, 2003, 12:30 AM
#3
Addicted Member
Out of curiosity, what is the advantage of creating controls at runtime?
Take my love
Take my land
Take me where I cannot stand
I don't care, I'm still free
You can't take the sky from me...
-
Oct 1st, 2003, 12:47 AM
#4
Frenzied Member
From what i have learned from gurus here, i can say when you know what you are doing and it's planned , its better to add them at desgin time.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Oct 1st, 2003, 12:56 AM
#5
Addicted Member
But isn't it a lot more work to add them all like that instead of just slapping them on the form? And wouldn't that slow down your program if you had like a thousand controls to load?
Take my love
Take my land
Take me where I cannot stand
I don't care, I'm still free
You can't take the sky from me...
-
Oct 1st, 2003, 01:04 AM
#6
Frenzied Member
Originally posted by The Phoenix
But isn't it a lot more work to add them all like that instead of just slapping them on the form? And wouldn't that slow down your program if you had like a thousand controls to load?
Yes, more work, and more chance of run time errors.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Oct 1st, 2003, 07:08 AM
#7
Sleep mode
Usually , people do that they should have the Runtime Controls Manager part done (or whatever they call it) . This manager handles everything for runtime created controls from naming or setting some properties to the diffictult part which controlling events . I've seen one manager but I can't remember where . It's jut huge and it scared me really . Like 4 classes and I believe the possiblity of araisng errers is just zero . Most often , you need that when your app has a lot of controls while it's running , it eats up more memory and sends you an error message saying 'Out of Memory' . So , you tends to build that at runtime . Plus the exe would be farily smaller and faster .
-
Oct 1st, 2003, 01:06 PM
#8
Addicted Member
Ah. Thank you for the explanation Pirate.
Take my love
Take my land
Take me where I cannot stand
I don't care, I'm still free
You can't take the sky from me...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|