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

Class Design: Multiple Typed Parameters?

I'm using the 2.0 Wizard control which includes three basic control types in
its various steps; TextBox, DropDownList, and CheckBoxList controls. I'd
like to pass the results of the Wizard to a class but I don't understand how
to type the class or pass the arguments to the parameters of the class when
different types are involved.

All I think I need is confirmation and a signature typing the class
definition. While I'm off to read about generics to determine if this is how
I achieve my goal what would your comments be?

<%= Clinton Gallagher
Jan 17 '06 #1
4 1238
Clinton,

It's a little vague what you are trying to do. You are using the wizard
control, but are you looking for a general solution or are you looking to
return specific parameters?

My first guess is to return a key/value pair, which has the name of the
control, as well as the control itself. You can return a type of Control,
which all three derive from.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
I'm using the 2.0 Wizard control which includes three basic control types
in its various steps; TextBox, DropDownList, and CheckBoxList controls.
I'd like to pass the results of the Wizard to a class but I don't
understand how to type the class or pass the arguments to the parameters
of the class when different types are involved.

All I think I need is confirmation and a signature typing the class
definition. While I'm off to read about generics to determine if this is
how I achieve my goal what would your comments be?

<%= Clinton Gallagher

Jan 17 '06 #2
protected void Wizard1_FinishButtonClick( ... )
{

// Initialize a class named XmlFileWriter
XmlFileWriter wrt = XmlFileWriter( );

// Pass arguments in the method call
wrt.saveXmlFile( textBox1, textBox2)

} // click event

// Instance of the XmlFileWriter class
public class XmlFileWriter
{
// Method is strongly typed
public string saveXmlFile( string textBox1, string textBox2 )
{
...
}

} // class

Okay?
The arguments passed in the method call are of type string because they are
text entered into the TextBox controls. The parameters of the saveXmlFile
method are of type string and the return type of the saveXmlFile method is
of type string.

Now here's the problem.
I also need to pass a CheckBoxList with textBox1 and textBox2 in the method
call but I don't know how to type the parameter in the signature of the
method and I don't even think passing the CheckBoxList is even permitted in
this context...

// Pass arguments in the method call
wrt.saveXmlFile( textBox1, textBox2, checkBoxList1)

// What is the method signature and the modifer for checkBox1?
public string saveXmlFile( string textBox1, string textBox2, ... checkBox1)

The saveXmlFile method uses an instance of an XmlFileWriter to write an XML
file and I need the value of the ListItems from checkBoxList1 to populate
the XML file with data.

Clear as mud? :-)

<%= Clinton Gallagher



"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2***************@TK2MSFTNGP15.phx.gbl...
Clinton,

It's a little vague what you are trying to do. You are using the
wizard control, but are you looking for a general solution or are you
looking to return specific parameters?

My first guess is to return a key/value pair, which has the name of the
control, as well as the control itself. You can return a type of Control,
which all three derive from.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
I'm using the 2.0 Wizard control which includes three basic control types
in its various steps; TextBox, DropDownList, and CheckBoxList controls.
I'd like to pass the results of the Wizard to a class but I don't
understand how to type the class or pass the arguments to the parameters
of the class when different types are involved.

All I think I need is confirmation and a signature typing the class
definition. While I'm off to read about generics to determine if this is
how I achieve my goal what would your comments be?

<%= Clinton Gallagher


Jan 17 '06 #3
clintonG <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote:
Now here's the problem.
I also need to pass a CheckBoxList with textBox1 and textBox2 in the method
call but I don't know how to type the parameter in the signature of the
method and I don't even think passing the CheckBoxList is even permitted in
this context...
It's fine.
// Pass arguments in the method call
wrt.saveXmlFile( textBox1, textBox2, checkBoxList1)

// What is the method signature and the modifer for checkBox1?
public string saveXmlFile( string textBox1, string textBox2, ... checkBox1)
public string SaveXmlFile (string textBox1,
string textBox2,
CheckBoxList cbList)

Control classes are classes just like any other.
The saveXmlFile method uses an instance of an XmlFileWriter to write an XML
file and I need the value of the ListItems from checkBoxList1 to populate
the XML file with data.


You might want to consider passing in the values you want to write
rather than the CheckBoxList itself then, eg as a list of strings.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 17 '06 #4
<snip />

You might want to consider passing in the values you want to write
rather than the CheckBoxList itself then, eg as a list of strings.


I've taken your advice about passing the values. Thanks for your
support Jon.

<%= Clinton Gallagher
Jan 18 '06 #5

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

Similar topics

2
by: malcolm | last post by:
Hello, We have a robust (.NET 1.1 c# winforms) client-server application that utilizes many typed DataSets, typed DataTables and typed DataRows. Our application is a series of windows and popup...
18
by: Bradley | last post by:
I'm trying to determine if there's a general rule for when an Interface should used vs. an Abstract Class. Is there any design advantage to using one or the other? Brad
1
by: Chris Austin | last post by:
A co-worker asked me today what would happen if Session.Add() method was called multiple times with the same key. My first thought was that it would throw some sort of duplicate key exception. ...
15
by: Joe Fallon | last post by:
I would like to know how you can figure out how much memory a given instance of a class is using. For example, if I load a collection class with 10 items it might use 1KB, and if I load it with...
8
by: Joel Reinford | last post by:
I would like to build a class that has properties which can be accessed by string names or index numbers in the form of MyClass.Item("LastName"). The string names or item index values would be...
20
by: Scott M. | last post by:
What are the advantages of defining a class as part of another class definition (nesting classes)?
9
by: MariusI | last post by:
Consider the following class layout public class Order { public ProductOrder AddProductOrder(/* variables required to create a product order */) { /* Check if the product order can be added...
21
by: phpCodeHead | last post by:
Code which should allow my constructor to accept arguments: <?php class Person { function __construct($name) { $this->name = $name; } function getName()
7
by: Andy B | last post by:
I have a class I am creating for data access. I need to access controls from inside the class that are on a particular page. How do I do this? or is creating an instance of the page class and using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.