473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

LoadControl v calling constructor

a
Hi
Extremely easy question for someone who knows the answer I'm sure
:-) (aren't they all)

What exactly does LoadControl do? Whats the difference between calling
this and just constructing a user control?

Thanks

anon'ish
Nov 17 '05 #1
2 2373
AW
You need to understand the difference between Web Custom Controls and Web
User Controls.

Web Custom Controls, like the WebControls (DataGrid, Button, ...) are
classes. To create them you just call their constructor:
Dim b as Button = new Button()

Web User Controls are defined by an ASCX page (containing HTML) and a class.
The class is just the codebehind for the control, so if you call its
constructor you don't create the control. That's where the LoadControl
method is needed: you pass it the name of the ASCX page, and it loads both
this page and the CodeBehind class.
--
To reply, remove a "l" before the @ sign.

AW - MCT, MCSD.Net, MCAD.Net
Nov 17 '05 #2
When you create an ascx file you can specify the class name of the auto
generated class. The question is what is the difference between calling
LoadControl and calling a constructor of the generated class?

Jerry

"AW" <aw****@fr.xrt.com> wrote in message
news:eU*************@TK2MSFTNGP11.phx.gbl...
You need to understand the difference between Web Custom Controls and Web
User Controls.

Web Custom Controls, like the WebControls (DataGrid, Button, ...) are
classes. To create them you just call their constructor:
Dim b as Button = new Button()

Web User Controls are defined by an ASCX page (containing HTML) and a class. The class is just the codebehind for the control, so if you call its
constructor you don't create the control. That's where the LoadControl
method is needed: you pass it the name of the ASCX page, and it loads both
this page and the CodeBehind class.
--
To reply, remove a "l" before the @ sign.

AW - MCT, MCSD.Net, MCAD.Net

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Giulio | last post by:
why definition of two constructors like these is not possible in c++??? ----------------------- date::date(const int d, const int m, const int y, const int ora, const int mi, const int se){...
21
by: Philipp | last post by:
Hello, a very simple question: Ok I have a class MyClass with a constructor MyClass(int) (no constructor without argument defined) how can I make an array of pointers to objects of that class,...
5
by: lallous | last post by:
Hello, Probably I am not seeing it now, but is it possible for constructor(int) to call constructor() ? class A { private: int x, y; public:
9
by: Gonçalo Rodrigues | last post by:
Hi all, Is it possible to call a constructor of a class, call it Object, explicitely? e.g. suppose you have a void pointer ptr pointing to a block of memory big-enough to hold an Object. Is...
4
by: Daisy | last post by:
What I want to do is this: Object1 list = (Object1)this.MyMethod(typeOf(Object1), "Object1", "string1", "string2"); and Object2 list = (Object2)this.MyMethod(typeOf(Object2), "Object2",...
2
by: Josef Meile | last post by:
Hi, I have this constructor: public CExcelDatabase(string host, string user, string password, string database, bool promptCredentials, int findExcelInstance, bool readOnly) { //Some code...
8
by: Sam Kuehn | last post by:
How do I accomplish the fallowing (is it even possible). Say I write a UserControl "MyControl.ascx". Now I use LoadControl("MyControl.ascx"). But I really want MyControl to require parameters in...
4
by: Michael | last post by:
Hello, I want to use an object (LowCut) within another object (SampleRateConverter) like it is written as follows: class SampleRateConverter { public: SampleRateConverter( int...
3
by: Kavya | last post by:
Suppose I have class MyClass. Then which will be termed as explicit call to constructor. MyClass( ); or MyClass object; object.MyClass( );
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.