Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir,

How to create questions bank c# format is following

Eg.
Que.1.What is you name?
Ans................

if you click to the next Next Button then show

Que2..............
Ans.............

if you click the Previous button then go the previous button

without database I want in c# windows application

plz help me
Posted
Comments
Sadique KT 9-Jul-13 7:40am    
write question and answer as xml document,,,
Thanks7872 9-Jul-13 7:43am    
Why without database?than from where the question will come? and where the answers will be stored?
Pheonyx 9-Jul-13 7:45am    
Why do you not want to use a database?
Alternatives are CSV files, XML documents, a collection of text files. The world is your oyster.
You need to have some sort of indexing and tracking implemented so you know which question to back to, or forward to depending on what the user selects.

Also you need a method to store the response, I would suggest a different file to the questions file so that if multiple users are looking at the questions they don't see each others answers and override them.
BiteForce 9-Jul-13 8:12am    
I´d recommend writing an XML document.

1 solution

There are a huge number of ways to do this, but any form of storage that you are familiar with will work - a Database is probably just the most appropriate because it also allows you to store and / or manage the responses in a simple and structured manner. If you don't use a database, then the question storage is trivial, but storing the responses and relating them back to the user responding and the question they are responding to becomes quite complex.

However, the simplest way to store the questions is just to use a straight text file, and separate the question and the answer by a '|' character. You then keep Q&A pairs together by having each on a separate line, and process them with something like:
C#
string[] qAndA = File.ReadAllLines(pathToQAndAFile);
foreach (string pair in qAndA)
   {
   string[] pairs = pair.Split('|');
   if (pairs.Length == 2)
      {
      string question = pairs[0];
      string answer = pairs[1];
      ...
      }
   }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900