Write Articles A community of people who love to write

The easiest domain name (Note the .ORG) - Absolutely Free!
  

Home | Submit Articles | Login   
 
ALL Categories HEALTH EDUCATION FINANCE TECH WOMEN ENTERTAINMENT TRAVEL
 

How to develop a form in VB6 that supports two opposite languages (Arabic - Latin) simultaneously.

BY: PolyvalentComputerGuy | Category: Technology and Computers | Post Date: 2010-01-03
 



•    Read Comments

•    Print This Article



   PolyvalentComputerGuy
Help others find this article:

ADD TO StumbleUpon ADD TO DEL.ICIO.US ADD TO DIGG Share with FACEBOOK
Show All Social Bookmarks


Today I would like to expose how to design, create and code a form in visual basic that supports two languages that are written in an opposite way. For example, I take Arabic and English. There will several constraints to overcome.

1. Arabic is written from right to left. By cons, English is written from left to right. This will require us to switch direction at each transition field US / AR.

2. The characters in both languages are completely different. Therefore the character table should be loaded at each transition as well. (Note that the Unicode standard can cover all these characters)

3. When typing, the manual switch between the two languages may be very inconvenient for the user.

4. The user should be typing and not using the mouse and other options.


We must therefore manage these constraints and give the user the best possible interface.

1. To do this, it would be wise to design the form into two parts. The right for Arabic and left for English.

2. Now we have to make sure that your program distinguishes the input fields language (corresponding to the TextBox, ListBox, ....). Use the Tag property for each control to specify the input language (set it to 'a' for Arabic and 'e' for English).

NOTE: A good idea would be to create an indexed array of controls to make your coding easy.

3. Now select the Arabic controls and change the value of the RightToLeft option to True (this option is not available in older versions of VB). The typing will be from right to left.

4. The last thing to do is to ensure that once the user clicks in a control or the cursor gets into it, the language is set depending on the field tag.

We will need to create a module in which we define constants and the following procedure:


Declare Function ActivateKeyboardLayout Lib "user32" (ByVal HKL As Long, ByVal flags As Long) As Long
Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long

Global Const GlEnLang = 67699721 ' GetKeyboardLayout(0) vous permet d'obtenir le code
Global Const GlArLang = -265743359 'de la langue courante



Sub SwitchKeyboard(language As String)
Dim d As Long
d = 0
Select Case LCase(language)
Case "a"
d = ActivateKeyboardLayout(GlArLang, 0)
Case "e"
d = ActivateKeyboardLayout(GlEnLang, 0)
End Select
End Sub



At this level, I think the above code is quite clear and it is not necessary to make comments.

5. Select a control and then double-click it and go to the GotFocus event. Insert the following code:

Call SwitchKeyboard(Left(fldText(Index).Tag, 1))



You just have to test your form now!


NOTE: For the connection to the database you can either link the fields to the DataSet in design mode or use the code to do it manually. I will not go into details as this may be the subject of another article. Indeed, we must configure the code pages in the database (and this depends on the DBMS used) to avoid having corrupted data.

Article Source: http://www.saching.com



About Author / Additional Info: K.Marouf I am a computer systems engineer working as project chief manager at COSIDER Algeria. I develop softwares, maintain computers, train people and all what is related to handy jobs.

Additional Articles:
* Manipulation in Love
* Learn how to start dating after a divorce
* It's finger licking good... The world of Advertisements!
* Facts that every parent need to know about baby teething
* The various benefits of attending college and pursuing higher education

Does this article violate or infringe on your copyright ?
It is a violation of our terms for authors to submit content which they did not write and claim it as their own. If this article infringes on your copyrights, then use our Contact us form with the detailed proof of infringement along with the offending article's title, URL and writer name. If you do not hear back from us then contact us again in another 10 days. Thank you.




Comments on this article: (0 comments so far)

* Additional comments are now closed for this article *
Comment Comment By Comment Date



Article Views: 5774

Page copy protected against web site content infringement by Copyscape
Copyright 2010 saching.com - Do not copy articles from this website.


Important Disclaimer: All articles on this website are for general information only and is not a professional or experts advice. We do not own any responsibility for correctness or authenticity of the information presented in this article, or any loss or injury resulting from it. We do not endorse these articles, we are neither affiliated with the authors of these articles nor responsible for their content. Please see our disclaimer section for complete terms.


| Home | Disclaimer | Xhtml |