I need to make a class and not quite sure how to go about doing this part. I
want the class to take user input, build a dataset based on that input and
then return it from the class so it can be used elsewhere. A few things
about the dataset and the class that builds the dataset:
1. The dataset should already have prebuilt tables and columns that need to
be filled in like Header, Sections, Glossary, FormHeader, Contacts and
FormFooter. The other table, EventsForm has to be created "on the fly".
2. The class that generates the dataset needs to have different methods. A
method for each table and one for actually returning the dataset to an
application for use.
Where would I get started doing something like this? I do know how to make
classes in general, but not using "global" objects in a class.
Peter Duniho - 25 May 2008 02:11 GMT
> [...]
> Where would I get started doing something like this? I do know how to
> make
> classes in general, but not using "global" objects in a class.
Your question is not very clear. Are you having trouble with the DataSet
and/or DataTable instantiation? Or is this more of an architectural
question, where the fact that you're dealing with those specific classes
(DataSet and DataTable) isn't specifically relevant?
If the latter, then it sounds as though you're looking for the "static"
keyword, which allows you to write a method in a class where there's no
need to have an actual instance of that class.
If that's not the answer, you may want to consider rephrasing your
question, making sure you leave out everything that is not strictly
relevant, and making sure that anything that is relevant, you explain
_why_ it's relevant.
Pete
zane546@hotmail.com - 25 May 2008 12:53 GMT
> I need to make a class and not quite sure how to go about doing this part. I
> want the class to take user input, build a dataset based on that input and
[quoted text clipped - 10 lines]
> Where would I get started doing something like this? I do know how to make
> classes in general, but not using "global" objects in a class.
I'm not sure I understand the question. If you are asking about the
simplest/most common way to have a class accept input and return a
DataSet is to create a method which takes the input as the arguments
and returns the DataSet it builds:
DataSet myOperation(argument1, argument2, ...)
Exposing internal variables and objects of a class is generally not a
good idea, since other classes may change these variables - even to
illegal values - without the class knowing about it, causing problems.
The idea of using methods to access internal variables is to have the
class know which variables are being modified (and restricting those
which cannot), and also to validate any data given as input.
--
LAILA PAAVILAINEN JAN AALTOLA EERO PARTANEN
SANNA KASKILAHTI IIKKA PAAVOLAINEN LAILA NIEMINEN
TUUKKA ANTTOLAINEN PAAVO PALOLUOMA TAINA HAAPIAINEN