Computer Science Canada

How to use the Right-to-Left option? (For another language)

Author:  Ashi_Mashi2 [ Sun Mar 27, 2005 2:10 pm ]
Post subject:  How to use the Right-to-Left option? (For another language)

Hi agian...thanks for you great support....
i need to write something in Persian in a textbox (persian language is written from right-to-left). Now, there is a Times-New-Roman font that has 'arabic' in it. I can use it fine, but, my problem is when i run the program (making it .exe) on another computer, the words come from left-to-right, so it doesnt make sense...how can i get it back? I played with the VB options, and came across the right-to-left option, but, I cant change it to 'true'....
thanks for your help in advance

Author:  Brightguy [ Tue Mar 29, 2005 2:27 pm ]
Post subject:  Re: How to use the Right-to-Left option? (For another langua

It seems the RightToLeft property is operational only in "a bidirectional 32-bit Microsoft Windows environment, such as Arabic Microsoft Windows 95".

Of course, you could change the Alignment to "Right Justify" simulate Right-to-Left behaviour by changing how the characters are added to the text box in the KeyPress event, for example:
VisualBASIC:
Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii <> vbKeyBack Then
        Dim SelStart As Integer
        SelStart = Text1.SelStart
        If Text1.SelLength > 0 Then
            Text1.Text = Left(Text1.Text, SelStart) & Right(Text1.Text, Len(Text1.Text) - SelStart - Text1.SelLength)
            Text1.SelStart = SelStart
        End If
        Text1.Text = Left(Text1.Text, SelStart) & Chr(KeyAscii) & Right(Text1.Text, Len(Text1.Text) - SelStart)
        Text1.SelStart = SelStart
        KeyAscii = 0
    End If
End Sub

...That should do it. I think the Backspace/Delete keys are reversed, though.


: