473,378 Members | 1,479 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,378 software developers and data experts.

Setting properties at design-time faster than at run-time?

In a .NET Windows app, if I set somehting like the title of the form to
"MyApp" at run-time, will that make the app run slightly slower than if I
had set the title at design-time?

Thanks,
Ron
Oct 7 '06 #1
7 1985

Ronald S. Cook wrote:
In a .NET Windows app, if I set somehting like the title of the form to
"MyApp" at run-time, will that make the app run slightly slower than if I
had set the title at design-time?

Thanks,
Ron
Ron,

I don't see how since the designer simply sets the property in code
anyway.

--
Tom Shelton

Oct 7 '06 #2
The designer simply writes the code for you. There
is no real difference.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/..._generator.asp

"Tom Shelton" <to*@mtogden.comwrote in message
news:11*********************@c28g2000cwb.googlegro ups.com...
>
Ronald S. Cook wrote:
>In a .NET Windows app, if I set somehting like the title of the form to
"MyApp" at run-time, will that make the app run slightly slower than if I
had set the title at design-time?

Thanks,
Ron

Ron,

I don't see how since the designer simply sets the property in code
anyway.

--
Tom Shelton

Oct 8 '06 #3

Robbe Morris [C# MVP] wrote:
The designer simply writes the code for you. There
is no real difference.
That is what I was trying to say... Perhaps I was unclear.

--
Tom Shelton

Oct 8 '06 #4
Hi Op.

If you click on the designer generated code on the + in version 1.x or look
in the designer class if you put in top of the Solution Explorer "Show all
files" in the class with the name xx.designer.cs than you see the generated
code. That is mostly better than that you or I would do it by hand.

I thought Tom was pretty clear, but before somebode doubt in that.

:-))))))

Cor
"Tom Shelton" <to*@mtogden.comschreef in bericht
news:11**********************@e3g2000cwe.googlegro ups.com...
>
Robbe Morris [C# MVP] wrote:
>The designer simply writes the code for you. There
is no real difference.

That is what I was trying to say... Perhaps I was unclear.

--
Tom Shelton

Oct 8 '06 #5
There can be a differences to designer and runtime setting of
properties.

If you look at the designer generated code it sometimes wraps
BeginInit() and EndInit() around the setting of a controls properties.
This is so the control can optimise the initialising of properties,
generally by delaying any actions on the property until the EndInit.

Also, setting at run time could be done too late thus causing something
like the title to be drawn twice.

I would recommend using the design time setting if possible.

Tigger
Cor Ligthert [MVP] wrote:
Hi Op.

If you click on the designer generated code on the + in version 1.x or look
in the designer class if you put in top of the Solution Explorer "Show all
files" in the class with the name xx.designer.cs than you see the generated
code. That is mostly better than that you or I would do it by hand.

I thought Tom was pretty clear, but before somebode doubt in that.

:-))))))

Cor
"Tom Shelton" <to*@mtogden.comschreef in bericht
news:11**********************@e3g2000cwe.googlegro ups.com...

Robbe Morris [C# MVP] wrote:
The designer simply writes the code for you. There
is no real difference.
That is what I was trying to say... Perhaps I was unclear.

--
Tom Shelton
Oct 8 '06 #6
Tigger,

Maybe is that your intention, but it can be readed in another way.

The so called design time properties can also be used by code yourself.

Cor

"Tigger" <to**@grunt.tvschreef in bericht
news:11**********************@e3g2000cwe.googlegro ups.com...
There can be a differences to designer and runtime setting of
properties.

If you look at the designer generated code it sometimes wraps
BeginInit() and EndInit() around the setting of a controls properties.
This is so the control can optimise the initialising of properties,
generally by delaying any actions on the property until the EndInit.

Also, setting at run time could be done too late thus causing something
like the title to be drawn twice.

I would recommend using the design time setting if possible.

Tigger
Cor Ligthert [MVP] wrote:
>Hi Op.

If you click on the designer generated code on the + in version 1.x or
look
in the designer class if you put in top of the Solution Explorer "Show
all
files" in the class with the name xx.designer.cs than you see the
generated
code. That is mostly better than that you or I would do it by hand.

I thought Tom was pretty clear, but before somebode doubt in that.

:-))))))

Cor
"Tom Shelton" <to*@mtogden.comschreef in bericht
news:11**********************@e3g2000cwe.googlegr oups.com...
>
Robbe Morris [C# MVP] wrote:
The designer simply writes the code for you. There
is no real difference.
That is what I was trying to say... Perhaps I was unclear.

--
Tom Shelton

Oct 9 '06 #7
Yes,

As you stated, you can see that the designer adds its own code to set
the properties.

And you can do the same. It just might not be as efficient as the code
the designer makes due to the reasons I made. (Don't directly edit the
designer code unless you know what you are doing as there's a good
chance your changes will be lost)

We have come across speed issues in our application due to runtime
setting of properties. Our solution was to follow the pattern used by
the designer and implement and use the IInitializable interface
(BeginInit, EndInit) for our own runtime code.

We also had problems with the gui re-drawing as you change properties,
which can be very slow. These issues can be quite complex to solve at
times.

However, I don't think the Title property is one that will suffer from
any speed issues.

Tigger

Cor Ligthert [MVP] wrote:
Tigger,

Maybe is that your intention, but it can be readed in another way.

The so called design time properties can also be used by code yourself.

Cor

"Tigger" <to**@grunt.tvschreef in bericht
news:11**********************@e3g2000cwe.googlegro ups.com...
There can be a differences to designer and runtime setting of
properties.

If you look at the designer generated code it sometimes wraps
BeginInit() and EndInit() around the setting of a controls properties.
This is so the control can optimise the initialising of properties,
generally by delaying any actions on the property until the EndInit.

Also, setting at run time could be done too late thus causing something
like the title to be drawn twice.

I would recommend using the design time setting if possible.

Tigger
Cor Ligthert [MVP] wrote:
Hi Op.

If you click on the designer generated code on the + in version 1.x or
look
in the designer class if you put in top of the Solution Explorer "Show
all
files" in the class with the name xx.designer.cs than you see the
generated
code. That is mostly better than that you or I would do it by hand.

I thought Tom was pretty clear, but before somebode doubt in that.

:-))))))

Cor
"Tom Shelton" <to*@mtogden.comschreef in bericht
news:11**********************@e3g2000cwe.googlegro ups.com...

Robbe Morris [C# MVP] wrote:
The designer simply writes the code for you. There
is no real difference.


That is what I was trying to say... Perhaps I was unclear.

--
Tom Shelton
Oct 9 '06 #8

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

Similar topics

3
by: user | last post by:
I have gotten properties to respond correctly, but when I try to do it in __init__: class foo: def getter(self): return "hello" def __init__(self):
5
by: Disiac | last post by:
Hi, MS Class Library Guidelines clearly discourages use of Write-Only properties yet they're continuously availed in .NET after VB 6. Personally, I really don't use them anywhere. Tend to find...
0
by: Richard | last post by:
I am aware you cannot set report properties at runtime in access 2000 so I have a form the user fills in giving me all the properties settings for the report. Using basic code how can I get these...
3
by: countd4 | last post by:
I have built a working user control. However, to make it work, I always have to set certian properties using the properties sheet for the control when using it on other forms. I want to be able to...
8
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing...
1
by: David Veeneman | last post by:
I am writing a control that relies on its host to validate the contents of one of its fields. The control fires a custom 'FooNeedsValidating' event and passes the field's data with the event. The...
3
by: Water Cooler v2 | last post by:
How do you set Application object properties in design mode? I am doing a WinForms app using v1.1 of the framework and VS.NET 2003. In VB6, there used to be an App object and you could easily set...
6
by: Steve | last post by:
I have a div with two - three paragrahs in it. Each paragraph has its own inline style tag with its own font size setting. When I set the last paragraph's font size the font sizes for ALL of...
3
by: Ryan Liu | last post by:
Hi, When i add a connection string FpConnStr from application setting UI in VS 2008, it ends with sth. like: <connectionStrings> <clear /> <add...
0
by: Maric Michaud | last post by:
Le Wednesday 03 September 2008 15:57:50 mk, vous avez écrit : Your square property is not correctly defined, it recurselively call itself, it should be (I also avoided the extra lookup) : def...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.