473,569 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Own Class to WindowsApplicat ion

Hi,

I wish to write a WindowsApplicat ion which prompts the user to enter a
set of values in text boxes. I then what to write these values to an
xml file. I have created my own class where these values can be stored
as the application runs, but I am unsure where to declare an object
belonging to this class. Should it be in the program class as a static
member and do I then pass it to my Forms constructor?

Thanks for your help,

Barry.

Mar 8 '07 #1
2 1276
This is not a critical question. It could be done multiple ways. Having said
that, good OOP practices generally try to limit the visibility, scope and
lifetime of objects.

If the information is being collected in a child form then the child form,
after verifying the data, would create the Xml serialize object and make use
of it at the time that the user indicated that he was done with the data
entry.

If the information is being collected in the main form then I'd create the
Xml serialize object in the code that handles the user's indication that
data collection was complete.

It is generally more trouble to pass in an already created object to a child
form than it is to make the object locally plus having the object hang
around in places where it is not used just confuses the code.
--
Richard Lewis Haggard
www.Haggard-And-Associates.com

<bg***@yahoo.co mwrote in message
news:11******** **************@ t69g2000cwt.goo glegroups.com.. .
Hi,

I wish to write a WindowsApplicat ion which prompts the user to enter a
set of values in text boxes. I then what to write these values to an
xml file. I have created my own class where these values can be stored
as the application runs, but I am unsure where to declare an object
belonging to this class. Should it be in the program class as a static
member and do I then pass it to my Forms constructor?

Thanks for your help,

Barry.

Mar 8 '07 #2
Hi,

<bg***@yahoo.co mwrote in message
news:11******** **************@ t69g2000cwt.goo glegroups.com.. .
Hi,

I wish to write a WindowsApplicat ion which prompts the user to enter a
set of values in text boxes. I then what to write these values to an
xml file. I have created my own class where these values can be stored
as the application runs, but I am unsure where to declare an object
belonging to this class. Should it be in the program class as a static
member and do I then pass it to my Forms constructor?
If you only will have one instance of this class (there is only one set of
values) you can make it a Singleton.
Mar 8 '07 #3

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

Similar topics

11
2278
by: Steven D'Aprano | last post by:
Suppose I create a class with some methods: py> class C: .... def spam(self, x): .... print "spam " * x .... def ham(self, x): .... print "ham * %s" % x .... py> C().spam(3) spam spam spam
3
1582
by: Stefano Meier | last post by:
If in a WindowsApplication in the static main method I have something like: System.Console.WriteLine("Starting Application ..:"); and I start this WindowsApplication from a console I won't recive the "Starting Application ..:" message. Why?
3
4863
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
2
1577
by: overworkedJenny | last post by:
when i try to open a new project i get this long message with basically says WindowsApplication.vbproj is not installed. IS there any way to re-install it without installing/reinstalling the whole program...? plus when i try to uninstall vb.net my printer copy program come up????? help...anyone... OverWorkedJenny
0
873
by: overworkedJenny | last post by:
every time i try and open a new anything a message pops up basically stating my WindowsApplication.vbproj is not installed....i dont know what the file is... can i download this from a website....i dont have the program discs to reinstalle the whole program, and my computer wont let me uninstall the program either... HELP someone. thanks.
1
4077
by: dotnetnari | last post by:
hi, How to Drag and drop the nodes from treeview into datatable columns using windowsapplication in c# Thanks
0
1060
by: Jaime Lucci | last post by:
Hi everyone! I have a problem that I can't resolve. In VB2005 I've programmed a new class, where I use a Windows Form with four controls: a SplitContainer, a Panel, a Label and a TableLayoutPanel. I build my class and referenced it from a new WindowsApplication project. All controls have setted the anchor property. When I add an inherited...
6
15347
by: ffreino | last post by:
Hi, I have a Solution with two different Projects. In one project, can I import a class from another project? It's something like: Solution mySolution ProjectA Class A1
6
3673
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
I have a class library which contains 3 classes; one exposes all its behaviours and the other two are used internally by the public class. My problem is that although I can create an instance of the subservient classes, I cannot see the methods in them from the public class. Could someone guide me on this or give me a template? Thanks.
0
7701
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...
0
7924
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. ...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
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...
0
6284
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...
1
5514
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...
0
5219
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...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.