Beginner VB

Moderators: None (Apply to moderate this forum)
Number of threads: 1233
Number of posts: 2978

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Just need a little bit of help! Posted by xara on 3 Apr 2002 at 12:04 PM
Hello, I'm makeing a program that will write a story for you, based on the user imput. I think think what i am makeing is called a Madlib. I have 16 questions, and the answer that the user puts will be used in the story. I can't seem to get the story to appear though. I started by trying to make each sentance a string, and haveing the story appear on a differnt form, but that did not seem to work, the form would appear blank when i clicked the "Write story" command button. So now I am trying to use an OLE box to make the story appear in. But I can't figure out how to make the story appear after i get the user imput in this, i have never used an OLE box either. I tried the
*.visible = true, but i don't know for sure if i did it right. If anyone has any suggestions on what to do, (i'd rather try something other than have each sentace be a seperate sting), Please tell me!! Thanks

~Xara~
Report
Re: Just need a little bit of help! Posted by DaveR on 3 Apr 2002 at 12:15 PM
: Hello, I'm makeing a program that will write a story for you, based on the user imput. I think think what i am makeing is called a Madlib. I have 16 questions, and the answer that the user puts will be used in the story. I can't seem to get the story to appear though. I started by trying to make each sentance a string, and haveing the story appear on a differnt form, but that did not seem to work, the form would appear blank when i clicked the "Write story" command button. So now I am trying to use an OLE box to make the story appear in. But I can't figure out how to make the story appear after i get the user imput in this, i have never used an OLE box either. I tried the
: *.visible = true, but i don't know for sure if i did it right. If anyone has any suggestions on what to do, (i'd rather try something other than have each sentace be a seperate sting), Please tell me!! Thanks
:
: ~Xara~
:
there is only one way i know of doing this (sorry you have to have lots of strings)

strStory = strStory & strSentence(intCount) & txtMadLib(intCount).text

not this assumes you are using a parrell array when doing this and that you strSentece is declared as a array to do this you do
strSentence(1 to whatever); note i like to use one based arrays but vb defaults to 0.

you will also have to create a loop that is why i am using intCount this is the shortest way i know of doing this.

ps you might have alot of setting up string wise to be able to do this in the form load. but in the long run you might just want to create a file and go through a loop to store all the strings if you need more help just ask.

Report
Re: Just need a little bit of help! Posted by hobby on 3 Apr 2002 at 1:34 PM
: Hello, I'm makeing a program that will write a story for you, based on the user imput. I think think what i am makeing is called a Madlib. I have 16 questions, and the answer that the user puts will be used in the story. I can't seem to get the story to appear though. I started by trying to make each sentance a string, and haveing the story appear on a differnt form, but that did not seem to work, the form would appear blank when i clicked the "Write story" command button. So now I am trying to use an OLE box to make the story appear in. But I can't figure out how to make the story appear after i get the user imput in this, i have never used an OLE box either. I tried the
: *.visible = true, but i don't know for sure if i did it right. If anyone has any suggestions on what to do, (i'd rather try something other than have each sentace be a seperate sting), Please tell me!! Thanks
:
: ~Xara~
:

Write out your story as it is to a text file, but everywhere you want the user input to appear add a special tag such as %PLAYERNAME% or %HIPPOCOLOR%. Then you can have a person input their own words and save them into variables (either as public module variables or properties or as an array of string values). Then all you have to do is input the textfile one line at a time and do a Search and Replace in your code for the special tags and replace them with your variables. When you edit a line, you can then either concatenate it to a string or write it out to a textbox or even print it out to the form.

If you do write it out to the form, make sure the AutoRedraw property is set to true. And that you do not clear the form between line writes.


Report
Re: Just need a little bit of help! Posted by KDivad Leahcim on 4 Apr 2002 at 5:58 AM
: : Hello, I'm makeing a program that will write a story for you, based on the user imput. I think think what i am makeing is called a Madlib. I have 16 questions, and the answer that the user puts will be used in the story. I can't seem to get the story to appear though. I started by trying to make each sentance a string, and haveing the story appear on a differnt form, but that did not seem to work, the form would appear blank when i clicked the "Write story" command button. So now I am trying to use an OLE box to make the story appear in. But I can't figure out how to make the story appear after i get the user imput in this, i have never used an OLE box either. I tried the
: : *.visible = true, but i don't know for sure if i did it right. If anyone has any suggestions on what to do, (i'd rather try something other than have each sentace be a seperate sting), Please tell me!! Thanks
: :
: : ~Xara~
: :
:
: Write out your story as it is to a text file, but everywhere you want the user input to appear add a special tag such as %PLAYERNAME% or %HIPPOCOLOR%. Then you can have a person input their own words and save them into variables (either as public module variables or properties or as an array of string values). Then all you have to do is input the textfile one line at a time and do a Search and Replace in your code for the special tags and replace them with your variables. When you edit a line, you can then either concatenate it to a string or write it out to a textbox or even print it out to the form.
:
: If you do write it out to the form, make sure the AutoRedraw property is set to true. And that you do not clear the form between line writes.
:
:
:

One note: Don't get the file one line at a time, retrieve it in one read and then do the search/replace. Far fewer file reads and you won't have to rejoin the lines.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.