Doctor GME
New member
- Joined
- Jun 25, 2015
- Messages
- 1
- Programming Experience
- Beginner
i'm coding dictionary program dealing with idoms and sentences
as example if i wrote on english textbox:
it suppose to get this row from arabic column in database:
and applied in arabic textbox like this:
as the first line is arabic translation
and the second phrase means: (another meaning for this)
but i found the result like this:
as the marked word is arabic translation for (okay)
when i searched my database i found this row:
Resized to 87% (was 575 x 22) - Click image to enlarge
so the program applied the function twice
first on the text in english textbox
and second with the translated text itself, i want only the first
code for this function:
also the translation button click code:
as example if i wrote on english textbox:
it suppose to get this row from arabic column in database:
and applied in arabic textbox like this:
as the first line is arabic translation
and the second phrase means: (another meaning for this)
but i found the result like this:
as the marked word is arabic translation for (okay)
when i searched my database i found this row:
Resized to 87% (was 575 x 22) - Click image to enlarge
so the program applied the function twice
first on the text in english textbox
and second with the translated text itself, i want only the first
code for this function:
VB.NET:
Function getidom(ByVal content As String) As String Try
Dim count As Integer = 0
Using adp As New OleDb.OleDbDataAdapter("SELECT * FROM [Idoms]", connectionString)
Using tbl As New DataTable
If adp.Fill(tbl) > 0 Then
For Each row As DataRow In tbl.Rows
Dim en As String = row.Item("English").Replace("?", "\?")
Dim ar As String = row.Item("Arabic")
count += Regex.Matches(content, en, RegexOptions.IgnoreCase).Count
content = Regex.Replace(content, en, ar, RegexOptions.IgnoreCase)
Next
End If
End Using
End Using
Return content
Catch ex As Exception
MsgBox(ex.Message)
End Try
getidom = ""
End Function
also the translation button click code:
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = getidom(TextBox1.Text)