can this be check as well and point out the error

freddie_26

Newcomer
Joined
Mar 29, 2003
Messages
6
Location
st.Lucia
here's is what i want to do

i have a data in a text file in a array, i want to read the out the english words compared with the french and display the french in a text box
words are arrange like this in the text file
yes,oui,
the,le

the found = line is where the error seem to be occuring

Visual Basic:
Dim English, French, As String 
Dim i, where As Integer 
Dim Fword(), Eword(), As String 
Dim found As Boolean 

English = TxtEnglish.Text 
Fword = English.Split(" "c) 

For i = 0 To 30 
Do While ((Not found) And (where < rm.Length)) 
found = (Eword(i)) = rm(where, 0) 
where = where + 1 
Loop 
where = where - 1 
Fword(i) = rm(where, 1) 

Next 

TxtFrench.Text = Join(Fword, " ")

thanks guys
 
Last edited by a moderator:
What error are you getting?

It looks like your code structure is a little off. Perhaps you could explain
exactly how your code is meant to work (what is rm?) and we
could help you structure it better.
 
its a two dimensional array. the words have been placed in a text file in that format (yes, oui,at).
what i want o do is type the a sentence which contains the english word a display the translation in another language in this case french.

dim rm(30,3) as string
Dim English, French, As String
Dim i, where As Integer
Dim Fword(), Eword(), As String
Dim found As Boolean

English = TxtEnglish.Text
Fword = English.Split(" "c)

For i = 0 To 30
Do While ((Not found) And (where < rm.Length))
found = (Eword(i)) = rm(where, 0)
where = where + 1
Loop
where = where - 1
Fword(i) = rm(where, 1)

Next

TxtFrench.Text = Join(Fword," ")
 
It looks like you're never giving EWord any subscripts; you declare
it as Eword() (so you need to use Redim to dynamically size/initialize
it), but you never assign anything to it; you just get data out of it.

Perhaps when you say Fword = English.Split(...) you really mean
Eword = ...?

Also, you are going to need to give Fword an upper-bound. From the
way the code works, I'd say you could just change the declare from
Dim Fword() ... to Dim Fword(30) ...
 
i'm not quite sure what you mean when you say that i have not given it a subsript. can you just indicat that in the code that i have posted.

thanks for the trouble
 
Ok, try this:
Visual Basic:
dim rm(30,3) as string
Dim English, French, As String 
Dim i, where As Integer 
Dim Fword(30), Eword() As String 
Dim found As Boolean 

English = TxtEnglish.Text 
Eword = English.Split(" "c) 

For i = 0 To 30 
  Do While ((Not found) And (where < rm.Length)) 
    found = (Eword(i)) = rm(where, 0) 
    where = where + 1 
  Loop 
  where = where - 1 
  Fword(i) = rm(where, 1) 
Next 

TxtFrench.Text = Join(Fword," ")
 
It means you're trying to access an array element that is not in
the array (for example, accessing myArray(100) when myArray only
has 20 elements). I think there is a major flaw in your logic. Your
code would only work if the user typed 30 words or more in the
txtEnglish textbox. I'm sorry I can't really help you more, but I don't
totally know what your problem is. :-\
 
Back
Top