TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Michael Mortensen
NA
8
4.4k
Calling specific lines from a notepad file
Apr 19 2014 5:45 PM
I'm coding a Jeopardy game and I heard a guys talking about a pretty cool way of calling the Qs and As.
I don't know how to code it myself, I only know how it worked.
WHAT HE MADE:
OK, so he created a new Folder (in the same folder as the project file) containing txt files with questions and answers in them.
one txt file per subject (so six of those), and one txt file containing the subject titles (six lines, one subject title per line)
The name of the txt files were 1.txt, 2.txt. 3.txt, 4.txt, 5.txt, 6.txt and Subjects.txt
The txt files would have the first line be the question for 100, the second line would be the answer to the 100 question. Then the third line would be the question for 200, and the fourth line would be the answer to the 200 question, and so on up untill the fifth question and answer of that subject.
WHAT HE DID WITH THAT:
He made a code that said "find out where the project file is located", thus knowing where all the folders with the questions, were located.
He had a drop down menu (in the program), where you could choose what Q&As you wanted to use (it would contain the names of the Folders, say two folders called "Questions April 18" and "Question March 23").
He then told the labels that shows the subject titles, to get their titles from the Subject.txt file. The first label taking the text from the first line of that file, the second label taking the text from the second line of that file etc.
Then, let's say you clicked (when running the program) on the 400 question under the second subject, it would go to the chosen folder, go to the 2.txt file, and show the text from line 7 in that file (because that would be Question 4,,, in Jeopardy terms though you'd call it Answer 4, but I like to call what the Host asks, the Question).
Thanks in advance, I know this seems like a big mouthful, but I'm sure it's not that crazy for somebody who's good (better than me) at C#.
Reply
Answers (
0
)
About Blog
How to do SEO for ASP.NET based website