|
-
May 29th, 2003, 06:42 PM
#1
[resolved] Dynamic controls...
In VB6, you can add a control to a form by its name, ie
VB Code:
Controls.Add("VB.Label","SomeLabel")
Does such a beast exist in .NET? In other words, I don't necessarily want to have to declare something as a Textbox in order to add it to the form. I would like to declare a Control, and be able to choose what the type of control it will be at run time.
Last edited by crptcblade; May 29th, 2003 at 09:16 PM.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
May 29th, 2003, 07:25 PM
#2
Re: Dynamic controls...
Originally posted by crptcblade
In VB6, you can add a control to a form by its name, ie
VB Code:
Controls.Add("VB.Label","SomeLabel")
Does such a beast exist in .NET? In other words, I don't necessarily want to have to declare something as a Textbox in order to add it to the form. I would like to declare a Control, and be able to choose what the type of control it will be at run time.
hmm I dont quite understand what you want to do. couldn't you just do something like this?
VB Code:
dim ctrl as control
if true = true then
ctrl = new textbox()
else
ctrl = new label
end if
me.controls.add ctrl
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
May 29th, 2003, 07:41 PM
#3
Not really, I don't think.
Written in VB6 already, I have a main container app (MDI), and it dynamically loads child forms and loads snap-in usercontrols by their ProgID (example - "SomeLib.SomeUsercontrol") onto the child form.
Can you think of a way to translate that into .NET?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
May 29th, 2003, 09:16 PM
#4
Know what? Never mind...I just realized I could probably just change the usercontrol to a form, and load it into the MDI container as the entire form. Stupid VB6 has corrupted my thinking.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
May 29th, 2003, 09:18 PM
#5
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
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
|