Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 17th, 2007, 05:58 AM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Default Customised Labels & Text (poss Language?)

I would like to add the functionality where a client can customise the wording that's used on my forms, to encompass differences in terminology.

For example; you would refer to pages in a book as "RIGHT" and "LEFT", but in the printing world, they call them "RECTO" and "VERSO" ... so for this example I want the default to be one and a custom to be the other ...

From my understanding, this can be done quite easily by using language resource files, in effect creating two languages for my application(s).

Could someone advise how to ...

(1) create the reference/resource file

(2) link 'button text' or 'label caption' to the file

(3) switch between the files

Any help appreciated, whether a few notes or pointer to a website that has some examples on it.


Regards,

Sean Anderson
__________________
Regards,

Sean Anderson
 
Old September 7th, 2007, 03:24 AM
Authorized User
 
Join Date: Sep 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prabodh_mishra
Default

1> VB comes with a resource editor to create one (enable it through Add-ins).

2> Create a string table with IDs 1100, 1101 etcs and its corresponding text to be displayed on labels, buttons. Keep first one or two digits of ID specific to language.

For Example if you need to switch caption of a label for two languages:

Create two items in string table of res
1100 = RIGHT
2100 = RECTO

Public constant language1 = 1
Public constant language2 = 2

Public constant label1Caption = 100

In event method where you want to change the language write
If language1 then
    lLangID = language1 & label1Caption
ElseIf language2 then
    lLangID = language2 & label1Caption
End If

Label1.Caption = LoadResString(lLangID)

Hope this pseudo-code will help.

3> You don't need to create more than one res file


Cheers,
Prabodh
 
Old October 1st, 2007, 11:47 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well... its not so easy as just using Resource files.

You are saying that you want customer customizable strings, and there are probably better ways to accomplish this.
Resource files have to be compiled into the application using them, and there isn't much sense in having your customer involved in building your project to use their customized strings.

If you do end up using resource files you can complile each one into its own separate dll that will then be able to be interchangeably used by your application. However, this is a very complex solution for what you desire.

On solution is you could provide a simple XML file that the end user can customize instead of using Resource files for this purpose. (other file formats could be used as well: INI file format, comma delimited. Also the values could be stored in the applications database if one is in use - or a new database could be added as part of the app for this purpose).

For example, the template XML file will contain an empty element for each customizable string. If the user wishes to override the default string with a custom string they would simply add the text to the element. Of course, you would have to provide code to use these strings. Since it will probably be a relatively short list, you could simply load all the replacement values on application start or refresh, and provide a "global" level object that must be called on each display of a screen or form to do any needed replacements.

Make sense?

Cheers,
Woody Z
http://www.learntoprogramnow.com
How to use a forum to help solve problems
 
Old October 2nd, 2007, 03:28 AM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It does make sense, indeed. Hadn't realised that the resource file needed compiling.

No matter which way it gets done, it's gonna be a ball ache - there's literally hundreds of them.

Regards,

Sean Anderson





Similar Threads
Thread Thread Starter Forum Replies Last Post
Language change in Text box nishab345 VB How-To 0 June 26th, 2007 09:13 AM
rich text / multi-language content humour General .NET 4 September 27th, 2004 04:39 AM
Hindi language fonts in text box ashu_gupta75 Classic ASP Basics 1 March 15th, 2004 05:21 AM
Right align text in labels in a templatecolumn texasraven ASP.NET 1.x and 2.0 Application Design 1 August 27th, 2003 08:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.