473,606 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Studio 2005 and the ".Designer" file...?!? Code practice in properties.

Hi

I have a created a custom usercontrol which inherites an Excel like
usercontrol. In this usercontrol I have a custom property called
SpreadTemplate, which is an enum with (at the moment) two members
called None and Pipeline.

When I set this property at design time it sets up the activesheet with
a number of columns, rows, headers etc. This is all fine and working as
it is supposed to. The problem is that all this information gets
written to the [form].designer file, which makes it more or less
permanent. Meaning if I change the way SpreadTemplate sets up the form,
I will have to go back into design time and reset the property, before
it has any effect. The code in the [form].designer file looks like this
(in VB.Net, but the same happens using C#):

'
'CalsepSpecific Spread1
'

Me.CalsepSpecif icSpread1.About = "2.5.2007.2 005"
....
Me.SpreadTempla te = Pipeline

'
'CalsepSpecific Spread1_Sheet1
'
Me.CalsepSpecif icSpread1_Sheet 1.SheetName = "Pipeline"
Me.CalsepSpecif icSpread1_Sheet 1.ColumnCount = 7
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. RowCount = 2
Me.CalsepSpecif icSpread1_Sheet 1.RowCount = 1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. AutoText =
FarPoint.Win.Sp read.HeaderAuto Text.Blank
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 0).Border =
ComplexBorder1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 0).Value =
"x-Position"
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 1).Border =
ComplexBorder1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 1).Value =
"y-Position"
....
Me.CalsepSpecif icSpread1_Sheet 1.Columns.Get(0 ).Width = 89.0!
....

And here comes another problem (besides having to go to the designer
and reapply the setting) and that is that some of the properties are
different at runtime (based on other settings), but these are
overridden by the ones above. Meaning when the line Me.SpreadTempla te =
Pipeline is done at runtime it might generate another text for
columnheader (0, 0), but this is then changed back into "x-position" by
the code generated in the [form].designer file.
I have tried experimenting with setting

<DesignerSerial izationVisibili ty(DesignerSeri alizationVisibi lity.Hidden)>
_
on the SpreadTemplate property, but this only affects whether the line
Me.SpreadTempla te = Pipeline gets written to the .designer file.

I realize that this is properly standard Visual Studio 2005, but still
it strikes me as pretty weird behaviour. Is there any way to deactivate
this or do anyone have another idea as how to handle this kind of
thing? Is it not good code practice to have one property set a number
of other properties? I could of course just do the SpreadTemplate =
Pipeline on form load or some other place that only gets called during
runtime, but I want to be able to see the changes at design time, so I
can design the rest of the form. I am really baffled at this behaviour,
please advise...!

Regards
....Seth

Jan 26 '07 #1
3 1639
Look for and attribute DesignerSeriali zationVisibilit y
[DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)]

Schneider

<se*****@gmail. comwrote in message
news:11******** *************@v 33g2000cwv.goog legroups.com...
Hi

I have a created a custom usercontrol which inherites an Excel like
usercontrol. In this usercontrol I have a custom property called
SpreadTemplate, which is an enum with (at the moment) two members
called None and Pipeline.

When I set this property at design time it sets up the activesheet with
a number of columns, rows, headers etc. This is all fine and working as
it is supposed to. The problem is that all this information gets
written to the [form].designer file, which makes it more or less
permanent. Meaning if I change the way SpreadTemplate sets up the form,
I will have to go back into design time and reset the property, before
it has any effect. The code in the [form].designer file looks like this
(in VB.Net, but the same happens using C#):

'
'CalsepSpecific Spread1
'

Me.CalsepSpecif icSpread1.About = "2.5.2007.2 005"
...
Me.SpreadTempla te = Pipeline

'
'CalsepSpecific Spread1_Sheet1
'
Me.CalsepSpecif icSpread1_Sheet 1.SheetName = "Pipeline"
Me.CalsepSpecif icSpread1_Sheet 1.ColumnCount = 7
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. RowCount = 2
Me.CalsepSpecif icSpread1_Sheet 1.RowCount = 1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. AutoText =
FarPoint.Win.Sp read.HeaderAuto Text.Blank
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 0).Border =
ComplexBorder1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 0).Value =
"x-Position"
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 1).Border =
ComplexBorder1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 1).Value =
"y-Position"
...
Me.CalsepSpecif icSpread1_Sheet 1.Columns.Get(0 ).Width = 89.0!
...

And here comes another problem (besides having to go to the designer
and reapply the setting) and that is that some of the properties are
different at runtime (based on other settings), but these are
overridden by the ones above. Meaning when the line Me.SpreadTempla te =
Pipeline is done at runtime it might generate another text for
columnheader (0, 0), but this is then changed back into "x-position" by
the code generated in the [form].designer file.
I have tried experimenting with setting

<DesignerSerial izationVisibili ty(DesignerSeri alizationVisibi lity.Hidden)>
_
on the SpreadTemplate property, but this only affects whether the line
Me.SpreadTempla te = Pipeline gets written to the .designer file.

I realize that this is properly standard Visual Studio 2005, but still
it strikes me as pretty weird behaviour. Is there any way to deactivate
this or do anyone have another idea as how to handle this kind of
thing? Is it not good code practice to have one property set a number
of other properties? I could of course just do the SpreadTemplate =
Pipeline on form load or some other place that only gets called during
runtime, but I want to be able to see the changes at design time, so I
can design the rest of the form. I am really baffled at this behaviour,
please advise...!

Regards
...Seth

Jan 26 '07 #2
Yeah, that was also what I tried, ie. I added the attribute to my
SpreadTemplate property, but the only effect was the Me.SpreadTempla te
= Pipeline line wasn't written to the InitializeCompo nent method. All
of the properties I set on the inherited control was still written. Is
there any way to prevent this? You cannot set the attribute for the
entire class (I tried) and I don't know how I can set it on methods
and properties on the base control. Perhaps overriding them, but in
this case that will be quite a lot of properties...
Suggestions?

....Seth

On 26 Jan., 20:28, "schneider" <eschnei...@sta rkinvestments.c em
wrote:
Look for and attribute DesignerSeriali zationVisibilit y
[DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)]

Schneider

<sege...@gmail. comwrote in messagenews:11* *************** *****@v33g2000c wv.googlegroups .com...
Hi
I have a created a custom usercontrol which inherites an Excel like
usercontrol. In this usercontrol I have a custom property called
SpreadTemplate, which is an enum with (at the moment) two members
called None and Pipeline.
When I set this property at design time it sets up the activesheet with
a number of columns, rows, headers etc. This is all fine and working as
it is supposed to. The problem is that all this information gets
written to the [form].designer file, which makes it more or less
permanent. Meaning if I change the way SpreadTemplate sets up the form,
I will have to go back into design time and reset the property, before
it has any effect. The code in the [form].designer file looks like this
(in VB.Net, but the same happens using C#):
'
'CalsepSpecific Spread1
'
Me.CalsepSpecif icSpread1.About = "2.5.2007.2 005"
...
Me.SpreadTempla te = Pipeline
'
'CalsepSpecific Spread1_Sheet1
'
Me.CalsepSpecif icSpread1_Sheet 1.SheetName = "Pipeline"
Me.CalsepSpecif icSpread1_Sheet 1.ColumnCount = 7
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. RowCount = 2
Me.CalsepSpecif icSpread1_Sheet 1.RowCount = 1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. AutoText =
FarPoint.Win.Sp read.HeaderAuto Text.Blank
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 0).Border =
ComplexBorder1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 0).Value =
"x-Position"
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 1).Border =
ComplexBorder1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 1).Value =
"y-Position"
...
Me.CalsepSpecif icSpread1_Sheet 1.Columns.Get(0 ).Width = 89.0!
...
And here comes another problem (besides having to go to the designer
and reapply the setting) and that is that some of the properties are
different at runtime (based on other settings), but these are
overridden by the ones above. Meaning when the line Me.SpreadTempla te =
Pipeline is done at runtime it might generate another text for
columnheader (0, 0), but this is then changed back into "x-position" by
the code generated in the [form].designer file.
I have tried experimenting with setting
<DesignerSerial izationVisibili ty(DesignerSeri alizationVisibi lity.Hidden)>
_
on the SpreadTemplate property, but this only affects whether the line
Me.SpreadTempla te = Pipeline gets written to the .designer file.
I realize that this is properly standard Visual Studio 2005, but still
it strikes me as pretty weird behaviour. Is there any way to deactivate
this or do anyone have another idea as how to handle this kind of
thing? Is it not good code practice to have one property set a number
of other properties? I could of course just do the SpreadTemplate =
Pipeline on form load or some other place that only gets called during
runtime, but I want to be able to see the changes at design time, so I
can design the rest of the form. I am really baffled at this behaviour,
please advise...!
Regards
...Seth- Skjul tekst i anførselstegn -- Vis tekst i anførselstegn -
Jan 27 '07 #3
Not sure what you guys have going on but there is also the
ShouldSerialize MyProperty method:
http://msdn2.microsoft.com/en-us/library/53b8022e.aspx

Keep in mind the DefaultValueAtt ribute also. These can all effect the
behavior.

Schneider

"Seth Gecko" <se*****@gmail. comwrote in message
news:11******** **************@ m58g2000cwm.goo glegroups.com.. .
Yeah, that was also what I tried, ie. I added the attribute to my
SpreadTemplate property, but the only effect was the Me.SpreadTempla te
= Pipeline line wasn't written to the InitializeCompo nent method. All
of the properties I set on the inherited control was still written. Is
there any way to prevent this? You cannot set the attribute for the
entire class (I tried) and I don't know how I can set it on methods
and properties on the base control. Perhaps overriding them, but in
this case that will be quite a lot of properties...
Suggestions?

....Seth

On 26 Jan., 20:28, "schneider" <eschnei...@sta rkinvestments.c em>
wrote:
Look for and attribute DesignerSeriali zationVisibilit y
[DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)]

Schneider

<sege...@gmail. comwrote in
messagenews:11* *************** *****@v33g2000c wv.googlegroups .com...
Hi
I have a created a custom usercontrol which inherites an Excel like
usercontrol. In this usercontrol I have a custom property called
SpreadTemplate, which is an enum with (at the moment) two members
called None and Pipeline.
When I set this property at design time it sets up the activesheet with
a number of columns, rows, headers etc. This is all fine and working as
it is supposed to. The problem is that all this information gets
written to the [form].designer file, which makes it more or less
permanent. Meaning if I change the way SpreadTemplate sets up the form,
I will have to go back into design time and reset the property, before
it has any effect. The code in the [form].designer file looks like this
(in VB.Net, but the same happens using C#):
'
'CalsepSpecific Spread1
'
Me.CalsepSpecif icSpread1.About = "2.5.2007.2 005"
...
Me.SpreadTempla te = Pipeline
'
'CalsepSpecific Spread1_Sheet1
'
Me.CalsepSpecif icSpread1_Sheet 1.SheetName = "Pipeline"
Me.CalsepSpecif icSpread1_Sheet 1.ColumnCount = 7
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. RowCount = 2
Me.CalsepSpecif icSpread1_Sheet 1.RowCount = 1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. AutoText =
FarPoint.Win.Sp read.HeaderAuto Text.Blank
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 0).Border =
ComplexBorder1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 0).Value =
"x-Position"
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 1).Border =
ComplexBorder1
Me.CalsepSpecif icSpread1_Sheet 1.ColumnHeader. Cells.Get(0, 1).Value =
"y-Position"
...
Me.CalsepSpecif icSpread1_Sheet 1.Columns.Get(0 ).Width = 89.0!
...
And here comes another problem (besides having to go to the designer
and reapply the setting) and that is that some of the properties are
different at runtime (based on other settings), but these are
overridden by the ones above. Meaning when the line Me.SpreadTempla te =
Pipeline is done at runtime it might generate another text for
columnheader (0, 0), but this is then changed back into "x-position" by
the code generated in the [form].designer file.
I have tried experimenting with setting
<DesignerSerial izationVisibili ty(DesignerSeri alizationVisibi lity.Hidden)>
_
on the SpreadTemplate property, but this only affects whether the line
Me.SpreadTempla te = Pipeline gets written to the .designer file.
I realize that this is properly standard Visual Studio 2005, but still
it strikes me as pretty weird behaviour. Is there any way to deactivate
this or do anyone have another idea as how to handle this kind of
thing? Is it not good code practice to have one property set a number
of other properties? I could of course just do the SpreadTemplate =
Pipeline on form load or some other place that only gets called during
runtime, but I want to be able to see the changes at design time, so I
can design the rest of the form. I am really baffled at this behaviour,
please advise...!
Regards
...Seth- Skjul tekst i anførselstegn -- Vis tekst i anførselstegn -

Jan 29 '07 #4

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

Similar topics

8
5422
by: Joriz | last post by:
I have an errror when I open up a solution file from the Web. "Selected file is not a valid Visual studio file.".. But when I open it in "OPEN solution" and I browse for the file..it works fine.. Any ideas??
0
1152
by: Chris Snyder | last post by:
OK. Here's the short form: I have a non-abstract base page class that other forms inherit from. I keep getting the infamous "file could not be loaded into the designer, file name <x> could not be found. I tried checking the context in the OnLoad, no luck. None of the solutions in the help file apply to me. However, I have found that if I change the return type of one property, everything works fine.
0
1425
by: shaker | last post by:
While using the Visual Studio Code Editor, I somehow accidentally managed to turn on the display of formatting marks (such as tabs, spaces, and carriage returns). How do I turn this off? Thanks. Shaker
0
1358
by: shaker | last post by:
I hope that this is an appropriate palce for ask the question below. If not, I would appreciate getting a pointer to an appropriate group. While using the Visual Studio Code Editor, I somehow accidentally managed to turn on the display of formatting marks (such as tabs and spaces). In other words, my source code shows each space as a period and each tab as an ->. I am wondering whether someone can tell me how to turn this off. I...
0
2511
by: Lyle Avery | last post by:
Hi guys, An uninstall of a previous version of Visual Studio, or anything (3rd party dev tools)else happen to unregister these (VS 2005) file extensions. I've tested the ¡°Restore File Associations¡± button in Tools->Options->General, but no effect. Who know why? And then, how to restore these file associations without Repair the whole product? Please help me, thanks in advance! So quirk issues...
3
1285
by: susiedba | last post by:
hey I want to execute VB 2005 code within a job in SQL 2005; all I see there is 'ActiveX script' is SQL 2005 going to support VB 2005 sometime soon? THANKS Susie
3
5264
by: Steven Nagy | last post by:
Hi all, ASP.NET : Framework 2.0 - C# A recent addition to my code generater will create GridView's and ObjectDataSource's in a control (ASCX). So the code gen creates an ascx, ascx.cs, ascx.designer.cs and a stylesheet. The 3 control files are placed together.
9
2263
by: TS | last post by:
how do i regenerate the designer file, mine got out of sync and i deleted it - thought it would create new one. thanks
0
1157
by: mr t | last post by:
Is there anyway to turn off visual studio file monitoring? It is interfering with my web application debugging. here is a problem: sometimes, BUT NOT ALL THE TIMES, when I create a directory using system.io.directory.create , in a web application, when i call system.io.directory.delete(filename, true), an exception is thrown that the directory is not empty. notice that I have added 'true' for recursive delete. when I close visual...
0
8009
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7939
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8078
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8299
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...
1
5962
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
3919
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
3964
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2442
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
1
1548
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.