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

Static Property

Hi,
Is it possible to create a Button control as a static property, via
the Form Designer, so that the instantiating code in the wizard
generated 'InitializeComponent()' need not to be modified?
I mean, I can add 'static' at the public declaration but then I also
need to change the auto-generated InitializeComponent() section
(remove the 'this') which is not advisable.

Any ideas? Thanks!
victor
Feb 1 '06 #1
2 1254
<victor>,

I don't know if you can do it from the designer. I really doubt it. I don't
see how a control can be a static.

You can create many instances of a form. Each control has underlaying native
windows, which can have only one parent.
I don't see how you can share a control between forms.

Even if you say that you are going to guarantee only one istance (singleton)
the windows forms designer is not meant to create singleton forms.
--

Stoitcho Goutsev (100)
<victor> wrote in message news:56********************************@4ax.com...
Hi,
Is it possible to create a Button control as a static property, via
the Form Designer, so that the instantiating code in the wizard
generated 'InitializeComponent()' need not to be modified?
I mean, I can add 'static' at the public declaration but then I also
need to change the auto-generated InitializeComponent() section
(remove the 'this') which is not advisable.

Any ideas? Thanks!
victor

Feb 1 '06 #2
Fine, thank you for responding. I was afraid of this outcome ...;
well, I'll try another way. Maybe a class argumented with the base
form will do .... .
cheers.

On Wed, 1 Feb 2006 09:32:26 -0500, "Stoitcho Goutsev \(100\)"
<10*@100.com> wrote:
<victor>,

I don't know if you can do it from the designer. I really doubt it. I don't
see how a control can be a static.

You can create many instances of a form. Each control has underlaying native
windows, which can have only one parent.
I don't see how you can share a control between forms.

Even if you say that you are going to guarantee only one istance (singleton)
the windows forms designer is not meant to create singleton forms.


Feb 1 '06 #3

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

Similar topics

4
by: DDE | last post by:
Hi All, Reformulating a problem from a previous post: How can I access an application variable from a static method? When I try: string myString = Application{"thisString"].ToString; ...
12
by: Sergey Klementiev | last post by:
Why it's impossible to have a static indexer in C#?
3
by: Ryan Steckler | last post by:
I found this behavior while trying to implement a singleton class. Below is a somewhat more straight forward example, though admittedly less useful in real life. The basic problem is that when a...
3
by: Erik Harris | last post by:
I apologize if this is a stupid question - I'm relatively new to OOP. I have a property that must exist in a class in order to be used by another class. The property, however, does not change with...
3
by: bauscharln | last post by:
hoi, I just wanted to add a static method to my interface, but that's not allowed! Is there a reason for this??? (Yes, I could make an abstract base class, but that's not what I want, since I...
6
by: RSH | last post by:
I'm having a bit of trouble understanding Static properties. I have two forms and I need to be able to access a property from from1 in form2. The code below does not work but I'm not sure why...
14
by: Dave Booker | last post by:
It looks like the language is trying to prevent me from doing this sort of thing. Nevertheless, the following compiles, and I'd like to know why it doesn't work the way it should: public class...
10
by: Franky | last post by:
I think I misread a post and understood that if I do: System.Windows.Forms.Cursor.Current = Cursors.WaitCursor there is no need to reset the cursor to Default. So I made all the reset...
8
by: Per Bull Holmen | last post by:
Hey Im new to c++, so bear with me. I'm used to other OO languages, where it is possible to have class-level initialization functions, that initialize the CLASS rather than an instance of it....
5
by: Dave | last post by:
Hello, Suppose you have a class with a static property with only a get (read only). You also have code in a static constructor that sets these properties but takes 1 hour to run. Now suppose...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.