freddie_26 Posted March 29, 2003 Posted March 29, 2003 (edited) 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 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 Edited March 29, 2003 by divil Quote
*Experts* Volte Posted March 29, 2003 *Experts* Posted March 29, 2003 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. Quote
freddie_26 Posted March 29, 2003 Author Posted March 29, 2003 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," ") Quote
*Experts* Volte Posted March 29, 2003 *Experts* Posted March 29, 2003 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) ... Quote
freddie_26 Posted March 29, 2003 Author Posted March 29, 2003 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 Quote
*Experts* Volte Posted March 29, 2003 *Experts* Posted March 29, 2003 Ok, try this: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," ") Quote
freddie_26 Posted March 29, 2003 Author Posted March 29, 2003 i'm getting an error message index outside the bound of the array what does that mean Quote
*Experts* Volte Posted March 29, 2003 *Experts* Posted March 29, 2003 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. :-\ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.