Input language problem


New member
Jun 1, 2010
Programming Experience
I'm trying to create a software program for translations between different languages. This effort started some years ago, with VB6. This program i try to write will be open any pair of languages could be added and also new words or expressions could be added in the respective dictionaries.

For this I have great need to be able to move across different languages and their systems of writing, in other words keyboard layouts etc. According to documentation from MS and other sources I used the appropriate class of InputLanguage. I have 2 InputLanguages one source and another target language. I declare then normaly

Public SourceLanguage As InputLanguage
Public TargetLanguage As InputLanguage
in a general Module and I did not forget to declare at the top of it the name space:

Imports System.Globalization

I made also the same for 2 cultures

Public SourceCulture As System.Globalization.CultureInfo
Public TargetCulture As System.Globalization.CultureInfo

Then I defined the 2 languages as follows:

For inx As Short = 0 To InputLanguage.InstalledInputLanguages.Count - 1
If InputLanguage.InstalledInputLanguages(inx).Culture.EnglishName.ToString.Contains("English") Then
SourceLanguage = InputLanguage.InstalledInputLanguages(inx)
End If
If InputLanguage.InstalledInputLanguages(inx).Culture.EnglishName.ToString.Contains("Greek") Then
TargetLanguage = InputLanguage.InstalledInputLanguages(inx)
End If

Also the program finds the keyboard codes by looping all possible values provided by .NET and sets the right ones, so for source

SourceKeyboardCode = 0
TargetKeyboardCode = 161
'for greek

then I set 2 fonts with respective keyboard codes "GdiCharSet" in .NET's dialect

SourceFont = New System.Drawing.Font(FTSystemFiles.SourceFont, _ FTSystemFiles.SourceFontSize, FontStyle.Regular, GraphicsUnit.Point, Val(FTSystemFiles.TargetCharacterSetCode))

and respectively

TargetFont = New System.Drawing.Font(FTSystemFiles.TargetFont, FTSystemFiles.TargetFontSize, FontStyle.Regular, GraphicsUnit.Point, Val(FTSystemFiles.TargetCharacterSetCode))

and setting the fonts of the 2 main text boxes (Editxt for the text) and (EdiTrad for the translation) respectively:

EdiTxt.Font = SourceFont
EdiTrad.Font = TargetFont

After all that, in the enter event of both text boxes I tried to determine the input languages of both these text boxes, as follows:

Private Sub EdiTrad_Enter(....)
InputLanguage.CurrentInputLanguage = TargetLanguage' for the translation language , and also

Private Sub EdiTxt_Enter(....)
InputLanguage.CurrentInputLanguage = SourceLanguage

I tried also to load different cultures in respective boxes but in vain. I made all possible combinations of above settings. Nothing, always what comes out is the extended ASCII characters e.g the accented European characters and not greek characters. The same i presume is true for other keyboard layouts as cyrillic (russian) or turkish or other scriptures.

I try to solve this problem for days now, if not for weeks

If anyone can help I would be really grateful. Please do it.

Thanks in advance
Top Bottom