473,739 Members | 3,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2008

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.co mwrote in message
news:11******** *************@c 28g2000cwb.goog legroups.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.co mschreef in bericht
news:11******** **************@ e3g2000cwe.goog legroups.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.co mschreef in bericht
news:11******** **************@ e3g2000cwe.goog legroups.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.tvs chreef in bericht
news:11******** **************@ e3g2000cwe.goog legroups.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.co mschreef in bericht
news:11******* *************** @e3g2000cwe.goo glegroups.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.tvs chreef in bericht
news:11******** **************@ e3g2000cwe.goog legroups.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.co mschreef in bericht
news:11******** **************@ e3g2000cwe.goog legroups.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
1994
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
3893
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 it as giving the 'highest' possible access to data as compared to a plain read. However, out of more than a passing interest, does anyone know of a clear cut reason why developers are clearly discouraged from using Write-Only properties?
0
1169
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 settings into the report without opening the report in design view as I still need to create an MDE File. Sorry if this question is very basic and I appreciate greatly help from anyone.
3
6634
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 set default values for most properties so the control will work as-is without requiring the developer to set them. I notice in the compment initialization code create when I drop the control on a form that all the properties are set to null or...
8
2265
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 happens. dim filt as string ... build filter string... UserControl.ReportFilter = filt
1
5255
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 host handles the event, validates the data and returns the validation results to the control by a callback to a control method, SetFooError(). All of that works great. If the host returns false on the validation, I display an error glyph next to...
3
3327
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 its properties in Project->Properties menu in the VS 6.0 IDE.
6
1965
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 the paragraphs change. Why? How can I stop it? I.E>
3
2446
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 name="CapiInterviewer.Properties.Settings.FpConnStr" connectionString="data source=PowerCapiData" providerName="System.Data.SQLite" />
0
175
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 fgetsquare(self): return self._square def fsetsquare(self,s): self._square = s self.value = math.sqrt(s)
0
9479
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9209
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6754
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6054
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.