Two Questions

Posted on 2003-03-27
Medium Priority
Last Modified: 2010-05-01
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!
Question by:Kfkm09
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Accepted Solution

rjdown earned 300 total points
ID: 8222233
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

Expert Comment

ID: 8222247
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
LVL 44

Expert Comment

ID: 8222366
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.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 8222520

noted thanks :)

Author Comment

ID: 8224193
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.

Author Comment

ID: 8224443
Thank you so much!

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question