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

C# questionnaire for windows ...

Dear NG,

I want to create a dynamic questionnaire/survey application
with .NET / C#. I want to ask questions and have several answer types:
Yes/No, 1-10, list of answers, eg. "Dog", "Bird" and "Chicken"

My very general question is: how would you design this? A user control
for every question-type? How could you get the questions on one form?

I really looking forward hearing your tips, tricks and ideas.

Thank you very much

Rudi
Jun 27 '08 #1
6 4780
You would simply use the correct control per question. If you have a yes/no
question, place Yes No RadioButtons next to the question. If you have a
question with a list of acceptable responses, use a listbox. This is what
controls are for. You shouldn't need user controls at all.

-Scott
"Lakesider" <in**@rudolfball.comwrote in message
news:1d**********************************@56g2000h sm.googlegroups.com...
Dear NG,

I want to create a dynamic questionnaire/survey application
with .NET / C#. I want to ask questions and have several answer types:
Yes/No, 1-10, list of answers, eg. "Dog", "Bird" and "Chicken"

My very general question is: how would you design this? A user control
for every question-type? How could you get the questions on one form?

I really looking forward hearing your tips, tricks and ideas.

Thank you very much

Rudi

Jun 27 '08 #2

Hmm.

I would create a control per question type.

I would create an interface like this:

public IRespondable
{
string ResponseValue {get;} //maybe this could be an int or guid instead
of a string
string ResponseText {get;}
bool SomethingIsSelected{get;}
}

Each of your controls would implement this interface.

That way, you could deal with each control on a interface level, and have a
guaranteed
ResponseValue
ResponseText
SomethingIsSelected

The last property would be used to make sure the user picked something, so
you can validate if all questions need a response.


"Lakesider" <in**@rudolfball.comwrote in message
news:1d**********************************@56g2000h sm.googlegroups.com...
Dear NG,

I want to create a dynamic questionnaire/survey application
with .NET / C#. I want to ask questions and have several answer types:
Yes/No, 1-10, list of answers, eg. "Dog", "Bird" and "Chicken"

My very general question is: how would you design this? A user control
for every question-type? How could you get the questions on one form?

I really looking forward hearing your tips, tricks and ideas.

Thank you very much

Rudi

Jun 27 '08 #3
Ooops, forgot the word "interface".

public interface IRespondable
{
string ResponseValue {get;}
string ResponseText {get;}
bool SomethingIsSelected{get;}
}

"sloan" <sl***@ipass.netwrote in message
news:um****************@TK2MSFTNGP02.phx.gbl...
>
Hmm.

I would create a control per question type.

I would create an interface like this:

public IRespondable
{
string ResponseValue {get;} //maybe this could be an int or guid
instead of a string
string ResponseText {get;}
bool SomethingIsSelected{get;}
}

Each of your controls would implement this interface.

That way, you could deal with each control on a interface level, and have
a guaranteed
ResponseValue
ResponseText
SomethingIsSelected

The last property would be used to make sure the user picked something, so
you can validate if all questions need a response.


"Lakesider" <in**@rudolfball.comwrote in message
news:1d**********************************@56g2000h sm.googlegroups.com...
>Dear NG,

I want to create a dynamic questionnaire/survey application
with .NET / C#. I want to ask questions and have several answer types:
Yes/No, 1-10, list of answers, eg. "Dog", "Bird" and "Chicken"

My very general question is: how would you design this? A user control
for every question-type? How could you get the questions on one form?

I really looking forward hearing your tips, tricks and ideas.

Thank you very much

Rudi


Jun 27 '08 #4
Why in the world would you go to all that trouble when the standard set of
controls provide for a return value and there are vaildation controls in
both the Web and Windows environments?
"sloan" <sl***@ipass.netwrote in message
news:um****************@TK2MSFTNGP02.phx.gbl...
>
Hmm.

I would create a control per question type.

I would create an interface like this:

public IRespondable
{
string ResponseValue {get;} //maybe this could be an int or guid
instead of a string
string ResponseText {get;}
bool SomethingIsSelected{get;}
}

Each of your controls would implement this interface.

That way, you could deal with each control on a interface level, and have
a guaranteed
ResponseValue
ResponseText
SomethingIsSelected

The last property would be used to make sure the user picked something, so
you can validate if all questions need a response.


"Lakesider" <in**@rudolfball.comwrote in message
news:1d**********************************@56g2000h sm.googlegroups.com...
>Dear NG,

I want to create a dynamic questionnaire/survey application
with .NET / C#. I want to ask questions and have several answer types:
Yes/No, 1-10, list of answers, eg. "Dog", "Bird" and "Chicken"

My very general question is: how would you design this? A user control
for every question-type? How could you get the questions on one form?

I really looking forward hearing your tips, tricks and ideas.

Thank you very much

Rudi


Jun 27 '08 #5
I would encapsulate all the logic into the control.

I'd pass it some data, perhaps a List<ListItemor Dictionary<int,string>.

Then my work is done of a certain "control type". I don't have to keep
copy/pasting datasource= and databind() calls.

I'd let the internal code of the put the values into the germane control.
Aka, populate a dropdownlist with the items in the Dictionary<int,string>.
Then (when I'm ready to collect the data)....I could loop over them. ~as the
interface~ to pull out their data. I don't have to deal with each type as a
concrete at that point.

...

Then when I needed a new control that I haven't thought of yet, all I have
to do is implement the interface, and I don't have to change my "collect the
values" logic.
I could also create a MyControlFactory, and pass in a key or something, and
then if the end user decided they wanted to go form a DropDownListBox to
Radio buttons, I could make the change with either a simple key update, or
config file update.

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!126.entry

He sounds like he's building a mini framework to handle his different
"answer the question" needs.

The difference is maintainable and updateable code. Versus the ole "just
code 'er on up" mentality.


"Scott M." <s-***@nospam.nospamwrote in message
news:u5**************@TK2MSFTNGP03.phx.gbl...
Why in the world would you go to all that trouble when the standard set of
controls provide for a return value and there are vaildation controls in
both the Web and Windows environments?
"sloan" <sl***@ipass.netwrote in message
news:um****************@TK2MSFTNGP02.phx.gbl...
>>
Hmm.

I would create a control per question type.

I would create an interface like this:

public IRespondable
{
string ResponseValue {get;} //maybe this could be an int or guid
instead of a string
string ResponseText {get;}
bool SomethingIsSelected{get;}
}

Each of your controls would implement this interface.

That way, you could deal with each control on a interface level, and have
a guaranteed
ResponseValue
ResponseText
SomethingIsSelected

The last property would be used to make sure the user picked something,
so you can validate if all questions need a response.


"Lakesider" <in**@rudolfball.comwrote in message
news:1d**********************************@56g2000 hsm.googlegroups.com...
>>Dear NG,

I want to create a dynamic questionnaire/survey application
with .NET / C#. I want to ask questions and have several answer types:
Yes/No, 1-10, list of answers, eg. "Dog", "Bird" and "Chicken"

My very general question is: how would you design this? A user control
for every question-type? How could you get the questions on one form?

I really looking forward hearing your tips, tricks and ideas.

Thank you very much

Rudi



Jun 27 '08 #6
I think you are inventing a sledghammer where a simple solution is already
available.

The OP tells us he/she is looking for Yes/No, pick from list types of
questions and there are standard controls and databinding mechanisms for
these controls to solve this need without having to reinvent the wheel.

-Scott
"sloan" <sl***@ipass.netwrote in message
news:O%******************@TK2MSFTNGP04.phx.gbl...
>I would encapsulate all the logic into the control.

I'd pass it some data, perhaps a List<ListItemor Dictionary<int,string>.

Then my work is done of a certain "control type". I don't have to keep
copy/pasting datasource= and databind() calls.

I'd let the internal code of the put the values into the germane control.
Aka, populate a dropdownlist with the items in the Dictionary<int,string>.
Then (when I'm ready to collect the data)....I could loop over them. ~as
the interface~ to pull out their data. I don't have to deal with each
type as a concrete at that point.

..

Then when I needed a new control that I haven't thought of yet, all I have
to do is implement the interface, and I don't have to change my "collect
the values" logic.
I could also create a MyControlFactory, and pass in a key or something,
and then if the end user decided they wanted to go form a DropDownListBox
to Radio buttons, I could make the change with either a simple key update,
or config file update.

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!126.entry

He sounds like he's building a mini framework to handle his different
"answer the question" needs.

The difference is maintainable and updateable code. Versus the ole "just
code 'er on up" mentality.


"Scott M." <s-***@nospam.nospamwrote in message
news:u5**************@TK2MSFTNGP03.phx.gbl...
>Why in the world would you go to all that trouble when the standard set
of controls provide for a return value and there are vaildation controls
in both the Web and Windows environments?
"sloan" <sl***@ipass.netwrote in message
news:um****************@TK2MSFTNGP02.phx.gbl...
>>>
Hmm.

I would create a control per question type.

I would create an interface like this:

public IRespondable
{
string ResponseValue {get;} //maybe this could be an int or guid
instead of a string
string ResponseText {get;}
bool SomethingIsSelected{get;}
}

Each of your controls would implement this interface.

That way, you could deal with each control on a interface level, and
have a guaranteed
ResponseValue
ResponseText
SomethingIsSelected

The last property would be used to make sure the user picked something,
so you can validate if all questions need a response.


"Lakesider" <in**@rudolfball.comwrote in message
news:1d**********************************@56g200 0hsm.googlegroups.com...
Dear NG,

I want to create a dynamic questionnaire/survey application
with .NET / C#. I want to ask questions and have several answer types:
Yes/No, 1-10, list of answers, eg. "Dog", "Bird" and "Chicken"

My very general question is: how would you design this? A user control
for every question-type? How could you get the questions on one form?

I really looking forward hearing your tips, tricks and ideas.

Thank you very much

Rudi




Jun 27 '08 #7

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

Similar topics

2
by: hp | last post by:
I'm currently developing an online questionnaire system for my dissertation and I have now come across a few problems. I'm developing an online approach recommendation system. The basic feature is...
3
by: Jason A. Thompson | last post by:
Dear Access Gurus, I have a database which I hoped to use to administer questionnaires, or rather that someone who knows nothing about Access could use to administer them. Each q'aire item is on...
3
by: Tom_F | last post by:
To comp.databases.ms-access -- I have a questionnaire for which I would like to design a MIcrosoft Access form. I understand that the proper Access table structure would be: Respondent_ID ...
0
by: Christian Zotter | last post by:
Hello NG, I am a student at UDA in Austria, Austrian Partner of International Universities. To finnish my study i have to do a final year project. I have choosen the topic 'Evaluation of low...
1
by: javedna | last post by:
Can PHP help with the following as I have tried in the MYSQL Forums and cant get any help Thanks Nabz ---------------------------------------- Hi I am developing a PHP MYSQL questionnaire...
7
by: javedna | last post by:
Hi guys Ive got a simple problem, im designing an online questionnaire and on submission the coding that I have used to validate whether a user has filled in all the questions is supposed to...
2
by: Vili | last post by:
Hi all I am having problems with creating an functional questionnaire with asp.net 2.0 and MSSQL 2005 database. I have a table with field id (key & auto int), clientId (int), QuestionId...
10
by: fishlab | last post by:
Hello I'm using visual basic 2005 and i'm really useless and completely stuck. i'm making a questionnaire with a track bar from 1-7 to collect reponses. I have three forms. The first form...
20
by: gremlin | last post by:
http://www.cilk.com/multicore-blog/bid/6703/C-Inventor-Bjarne-Stroustrup-answers-the-Multicore-Proust-Questionnaire
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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?
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
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...

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.