JHawker09
New member
- Joined
- Nov 6, 2007
- Messages
- 3
- Programming Experience
- Beginner
Hello,
I'm doing a translator program for a class.... But I am running into a problem when I do a search for the English word and take the value of French equivalent into an array. It gives me the error in my title.
I'm doing a translator program for a class.... But I am running into a problem when I do a search for the English word and take the value of French equivalent into an array. It gives me the error in my title.
VB.NET:
Public Class frmTranslator
Dim dt As New DataTable()
Dim RecordCount, Pos As Long
Dim connStr As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=LANGUAGES.mdb"
Dim SQLStr As String = "SELECT * FROM TTranslate"
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Close()
End Sub
Private Sub btnTranslate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTranslate.Click
If rbnFrench.Checked Or rbnGerman.Checked Then
If rbnFrench.Checked Then
FrenchTranslate()
Else
GermanTranslate()
End If
Else
MessageBox.Show("Please Check a Language to be translated to.")
End If
End Sub
Dim PT() As String
Private Sub FrenchTranslate()
Dim ToTranslate() As String
Dim I As Integer
Dim dataAdapter As New OleDb.OleDbDataAdapter(SQLStr, connStr)
ToTranslate = txtToTranslate.Text.Split(" ")
RecordCount = dt.Rows.Count
For I = 0 To ToTranslate.GetUpperBound(0)
For Pos = 0 To RecordCount - 1
If ToTranslate(I) = dt.Rows(Pos)("TEnglish") Then
PT(I) = dt.Rows(Pos)("TFrench") [COLOR="Red"]<---This is where the error was indicated[/COLOR]
Exit For
End If
Next Pos
Next I
'If Pos = RecordCount Then
' MessageBox.Show("Last Name Not Found")
'End If
End Sub
Private Sub GermanTranslate()
End Sub
Private Sub Translator_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dataAdapter As New OleDb.OleDbDataAdapter(SQLStr, connStr)
dataAdapter.Fill(dt)
RecordCount = dt.Rows.Count
Pos = 0
End Sub
End Class
Last edited: