Connecting Tech Pros Worldwide Forums | Help | Site Map

Technique/Form renaming dilemma

Newbie
 
Join Date: Feb 2007
Posts: 5
#1: Feb 7 '07
Hi,

I have just created an educational children's VB6 quiz program which has 10 questions and plays a sound file for each question. It has a counter to show the question number and the current score. At the end it displays the wrong answers and shows the correct solutions. Basically it's working really well though I doubt the code is elegant because it's my first app and I'm teaching myself.

Having completed the 10 question quiz which sits nicely in a folder with all its sound file and a embedded items, I wondered if I could copy and paste the lot into another folder and just change questions and sound files to make another (and then maybe another quiz). I'm pretty sure I can do that but eventually if I wanted to bring all the quizzes together under one application I would have a problem because the form numbers in each mini-quiz would be the same and then the program wouldn't run. So is there a quick and easy way to rename the FORMS in each new folder so that this will not be a problem?

I'm sure this whole thing sounds like a web designer's approach to programming but I am just starting and I want to get this thing running quickly without getting bogged down in difficult code. Later, when my skills improve I'm sure I'll see the folly of this for myself. Can anyone help?

vb6newbie



Lives Here
 
Join Date: Oct 2006
Posts: 1,626
#2: Feb 7 '07

re: Technique/Form renaming dilemma


Hi. The problem you are describing sound exactly like a database problem. Unless you have a powerful reason to continually create new forms for each application, I suggest you use generic forms and store your questions and answers, locations to files etc in a database. That should allow you to grow your app continuously.
Newbie
 
Join Date: Feb 2007
Posts: 5
#3: Feb 7 '07

re: Technique/Form renaming dilemma


Hi Willakawill,

That sounds like excellent advice and advice I will try to follow but I'm just not there yet. I have no idea how to start a database at this time but want to get some students busy using this application. Can you see any way forward for me with the proposal I originally made? Also, can you direct me to an outright newbie's tutorial on using a database?

VB6Newbie (I am an utter, utter newbie)

Quote:

Originally Posted by willakawill

Hi. The problem you are describing sound exactly like a database problem. Unless you have a powerful reason to continually create new forms for each application, I suggest you use generic forms and store your questions and answers, locations to files etc in a database. That should allow you to grow your app continuously.

Lives Here
 
Join Date: Oct 2006
Posts: 1,626
#4: Feb 7 '07

re: Technique/Form renaming dilemma


No matter if you use a database or not, the thinking is always the same. Generic forms and a scheme for calling the correct question and answer files. Keep the forms in the same folder. Move the other files to named folders and call them depending on which q&a app you are using. you can use a simple radio button selector for the type of quiz which, in your code, will link to a particular folder.
Newbie
 
Join Date: Feb 2007
Posts: 5
#5: Feb 7 '07

re: Technique/Form renaming dilemma


Hi Willakawill,

Thank you for taking an interest. I'm still confused. What I'm hoping to do is copy and paste my working template application. The trouble is that with duplicated FORM names, the duplicated FORMs can't be added into the project. Do I have to manually rename them and all the references to them in the code (if so, is there a quick way?). If not, for example, if two FORM25s exist but they are in different folder locations folderA\FORM25 and folderB\Form25 (and therefore unique) would that allow the program to run? If so, in this case how would I add these duplicate folders to the project?

From your earlier reply I think you mean that the questions should be on a separate file and be called into the program as appropriate. I haven't done it like that at all. The answers are in the code of a FORM and appear permanently while the form is visible. The user clicks a button and hears a randomly selected question and then she must choose one of the 5 options to answer.

VB6Newbie with near zero experience



Quote:

Originally Posted by willakawill

No matter if you use a database or not, the thinking is always the same. Generic forms and a scheme for calling the correct question and answer files. Keep the forms in the same folder. Move the other files to named folders and call them depending on which q&a app you are using. you can use a simple radio button selector for the type of quiz which, in your code, will link to a particular folder.

Lives Here
 
Join Date: Oct 2006
Posts: 1,626
#6: Feb 7 '07

re: Technique/Form renaming dilemma


You can continue with the duplicate code method. You can also set fire to your feet.

You might be surprised at how quickly you can alter your app to accept different sets of questions. The route you are describing is not one I would care to use under any circumstances and there is no fast way to do it. Imagine that you realise there is a much better way to present your questions and answers. You will have to alter every form for every app.

Good luck
Newbie
 
Join Date: Feb 2007
Posts: 5
#7: Feb 7 '07

re: Technique/Form renaming dilemma


Hi Willakawill,

Quote:

Originally Posted by willakawill


You might be surprised at how quickly you can alter your app to accept different sets of questions.

Okay, bearing in mind that I am genuinely extremely new to this and working from a book you would probably hate (Idiot's guide...), can you suggest how I could get a taste of the method you suggest without scaring myself away from VB programming? I am very busy and will never make a penny from what I'm doing. It's just a hobby. That explains my reluctance to get in too deep with skills I will not require often enough to maintain.

VB6newbie
Lives Here
 
Join Date: Oct 2006
Posts: 1,626
#8: Feb 7 '07

re: Technique/Form renaming dilemma


Well you might not be as new to this as you think.
Many beginners think that programming has to do with understanding the syntax of the language and typing in code.
Not so.
Most of the work is finding the problem and working out the answer. None of this involves code.
Once you know what the answer is you can decide which language to use and impliment the solution.
You have chosen vb regardless of the solution required. That is fine for now.
Your problem is:
You want to present a set of questions for which there are fixed answers as a test with entertaining sounds.
You want to present different sets
Possible solution:
You create an app with generic forms and a method of calling the different sets of questions i.e. the questions and answers are outside of the app in folders.
Your learning curve:
How to load q&a from files?
Well we need some sort of data structure into which we can load the q&a info and we need some sort of file access system to get at the data. This would normally be a database and we can use a file instead to cut down on complexity
The data structure would be something more than:
Expand|Select|Wrap|Line Numbers
  1. Private Type qanda
  2.    Question As String
  3.    Answer As String
  4. End Type
Then you could create an array:
Expand|Select|Wrap|Line Numbers
  1. Dim QAarr(10) As qanda
and so on
Newbie
 
Join Date: Feb 2007
Posts: 5
#9: Feb 8 '07

re: Technique/Form renaming dilemma


Hi Willakawill,

Well thanks for the long response which looks like very good advice. I will reconsider my methods and have a look at it at the weekend.

vb6newbie

[quote=willakawill]Well you might not be as new to this as you think.
Reply