Two Questions

Hi, I am making a speech recognition program in Visual Basic 6.0, and have come along two questions that are probably not very difficult to answer, but since I am a relative beginner... Well, you get the idea :-). First of all, I have an entire dictionary saved as a .TXT file in which every single line is another word. I was wondering if there was any way I could get those words into my VB program using the 'Case' operation. My second question is, how do I add on to the text in a text box instead of covering up what was just written in it with new text. For example, if I pressed a button that made a text box say "Hi", and then pressed another button that made the text box say "Hello", "Hi" would dissapear, and on would come "Hello". How could I make it say "Hi Hello" instead? Thank you in advanced!
Who is Participating?
rjdownConnect With a Mentor Commented:
Question 1: Not quite sure what you want, but it would probably be best to read it into an array like this:

'Find next free file

Counter = 0

Open App.Path & "dictionary.txt" For Input As #fnum
While Not EOF(fnum)
   Input #fnum, words(Counter)
   Counter = Counter + 1
Close #fnum

Question 2: Like this:

Text1 = Text1 + NewText
PS for Q2, if you want a space between the words, you would have to do it yourself:

Text1 = Text1 + " " + NewText

or alternatively

Text1 = Text1 + chr(32) + NewText
just a minor point---> it is MUCH safer to use the String Concatenation operator & rahter than +:

Text1.Text = Text1.Text & " " & NewText

it is also MUCH better style to use the EXPLICIT property, rather than the DEFAULT property (.TEXT is the DEFAULT property of a text box).  This will help if you EVER decide top upgrade to VB.NET, and in .NET, controls DO NOT HAVE DEFAULT PROPERTIES.

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


noted thanks :)
Kfkm09Author Commented:
So there isn't a way to get the words into Visual Basic using case? The reason I need to use this is because of the way I have written the rest of the program. I would have to change everything really.
Kfkm09Author Commented:
Thank you so much!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.