I posted this before and got a few answers that haven't worked for me so far. Therefore I'm going to post part of my code so you can see what I'm talking about. The highlighted part is what I pulled from another post and it's not working for me right now. I'm using visual studio 2008 and the program was written in Basic. I pulled most of this program from the net and started tweaking it to my needs, if you can help I appreciate it! Thanks! If you're familiar with arabic you will understand the letters, if not, just use A and B for the variables.
Public Class Form1
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If CheckBox1.Checked = True Then
TextBox2.Text = convert(TextBox1.Text)
End If
End Sub
Private Sub OpenToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
Dim AllText, LineOfText As String
OpenFileDialog1.Filter = "Text files (*.txt)|*.txt"
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> "" Then
Try '
FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)
Do Until EOF(1) '
LineOfText = LineInput(1)
AllText = AllText & LineOfText & vbCrLf
Loop
TextBox1.Text = AllText
TextBox1.Select(1, 0)
TextBox1.Enabled = True
Catch
MsgBox("Error opening file.")
Finally
FileClose(1)
End Try
End If
End Sub
Public Function convert(ByVal gaby As String)
Try
gaby = Replace(gaby.ToLower, "a", "ا")
gaby = Replace(gaby.ToLower, "ab", "اب")
gaby = Replace(gaby.ToLower, "ac", "اث")
gaby = Replace(gaby.ToLower, "b", "ب")
gaby = Replace(gaby.ToLower, "t", "ت")
gaby = Replace(gaby.ToLower, "c", "ث")
gaby = Replace(gaby.ToLower, "j", "ج")
gaby = Replace(gaby.ToLower, "h", "ح")
gaby = Replace(gaby.ToLower, "o", "خ")
gaby = Replace(gaby.ToLower, "d", "د")
gaby = Replace(gaby.ToLower, "z", "ذ")
gaby = Replace(gaby.ToLower, "r", "ر")
gaby = Replace(gaby, Chr(59), "ز")
gaby = Replace(gaby.ToLower, "s", "س")
gaby = Replace(gaby.ToLower, Chr(58), "ش")
gaby = Replace(gaby.ToLower, "x", "ص")
gaby = Replace(gaby.ToLower, "v", "ض")
gaby = Replace(gaby.ToLower, "u", "ط")
gaby = Replace(gaby.ToLower, "y", "ظ")
gaby = Replace(gaby.ToLower, """", "ع")
gaby = Replace(gaby.ToLower, "g", "غ")
gaby = Replace(gaby.ToLower, "f", "ف")
gaby = Replace(gaby.ToLower, "q", "ق")
gaby = Replace(gaby.ToLower, "k", "ك")
gaby = Replace(gaby.ToLower, "l", "ل")
gaby = Replace(gaby.ToLower, "m", "م")
gaby = Replace(gaby.ToLower, "n", "ن")
***gaby = Replace(gaby.ToLower, Chr(63), "ه", 1, Len(gaby) - 1)
If Microsoft.VisualBasic.Right(gaby, 1) = Chr(63) Then
Mid$(gaby, Len(gaby), 1) = "ة"
End If***
gaby = Replace(gaby.ToLower, "w", "و")
gaby = Replace(gaby.ToLower, "i", "ي")
gaby = Replace(gaby.ToLower, "e", "ء")
gaby = Replace(gaby.ToLower, "", "")
Catch
MsgBox("error converting")
End Try
Return gaby
End Function
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox2.Text = convert(TextBox1.Text)
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
MsgBox("سلام converter copyrights 2009" & vbCrLf & "تستمتع" & vbCrLf & "" & vbCrLf & "Hope this helps!!!")
End Sub
Private Sub AutoConvertToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AutoConvertToolStripMenuItem.Click
If CheckBox1.Checked = True Then
CheckBox1.Checked = False
Else : CheckBox1.Checked = True
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = String.Empty
TextBox2.Text = String.Empty
End Sub
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
SaveFileDialog1.Filter = "Text files (*.txt)|*.txt"
SaveFileDialog1.ShowDialog()
If SaveFileDialog1.FileName <> "" Then
FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
PrintLine(1, TextBox2.Text)
FileClose(1)
End If
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
End Class