473,406 Members | 2,549 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,406 software developers and data experts.

Form Property

How do you add a property to a form that will show up in the properties
window in the IDE? I can add the property to the form, but haven't been
able to see it in the properties window. I'm using the VS2005 if it makes
any difference... TIA
Dec 15 '05 #1
3 1110
Making designable controls is a bit more advanced than that. But for
something simple, try this:

Create a BASEFORM class which is just a standard windows form. Add your
public property to it.
Then add a second class to your project that inherits from your
BASEFORM class, instead of System.Windows.Forms.Form

Now you will see your new form has the property you created in your
base class.

When you say Property, make sure it really is a PROPERTY, not just a
public variable.
Ie.
private string _testProperty = "";
public string TestProperty {
get {
return _testProperty;
}
set {
_testProperty = value;
}
}

Hope this gives you a good starting point.
I used the help walktroughts in MSDN to learn more about creating
custom controls.
You might like these too.

Steven Nagy

Dec 15 '05 #2
Thanks a lot for the reply --- you hit the nail on the head! I'm psyched
for c#, but I'm finding the learning curve fun/challenging at the same time.

"Steven Nagy" <le*********@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Making designable controls is a bit more advanced than that. But for
something simple, try this:

Create a BASEFORM class which is just a standard windows form. Add your
public property to it.
Then add a second class to your project that inherits from your
BASEFORM class, instead of System.Windows.Forms.Form

Now you will see your new form has the property you created in your
base class.

When you say Property, make sure it really is a PROPERTY, not just a
public variable.
Ie.
private string _testProperty = "";
public string TestProperty {
get {
return _testProperty;
}
set {
_testProperty = value;
}
}

Hope this gives you a good starting point.
I used the help walktroughts in MSDN to learn more about creating
custom controls.
You might like these too.

Steven Nagy

Dec 15 '05 #3
No problems!

Slowly you'll learn to unlock the power and come to realise that OOP is
very easy in C#

Dec 15 '05 #4

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

Similar topics

10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
11
by: Brian D | last post by:
I have been searching for a while to find an answer to this and I must be searching on the wrong keywords. Below is a snippet of my form. There are other form items on it, but I need to submit...
2
by: Jason G | last post by:
** Any assistance you can provide would be greatly appreciated ** I have a main form with multiple sub-forms. On the main form, I have a checkbox that corresponds with each sub-form, and this...
5
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
3
by: ApexData | last post by:
I'm starting a new project. A Personnel System. I have considered opening a single bound form to the main employee table. The user can scroll the records to any individual. I would like to have a...
12
by: Rob | last post by:
Let's say you open Form1 that contains TabControl1 There are several tabs on TabControl1 Now you open a new Form2 that contains a User Control How can you determine the Selected tab in Form1...
6
by: Greg Strong | last post by:
Hello All, Is is possible to use an ADO recordset to populate an unbound continuous Subform? I've done some Googling without much luck, so this maybe impossible, but let me try to explain...
16
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and...
9
by: dhtml | last post by:
I have written an article "Unsafe Names for HTML Form Controls". <URL: http://jibbering.com/faq/names/ > I would appreciate any reviews, technical or otherwise. Garrett --...
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
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,...
0
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...
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,...
0
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...

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.