Custom controls & Localization

bloukewer

Well-known member
Joined
Jul 2, 2004
Messages
88
Programming Experience
3-5
I develop some of my own controls and furthermore make quite extensive use of VBPowerpack. My progs also have to provide language-support and be localizable, and this is where the problem lies.

When localizing a form, all the standard controls work perfectly. VBpowerpack components and my own does not, they stay the same (the language/layout etc) doesn't change. I tried setting my own control's localizable property to true, but then VS crashes when I place the control on a form.

What am I missing?
 

bloukewer

Well-known member
Joined
Jul 2, 2004
Messages
88
Programming Experience
3-5
Uhum

Seems that VS miraculously self-healed. It doesn't crash anymore, but my controls still do not respond to language-changes. For example:

I have a custom control called CustomFrame, whose localizability has been set to true. I place the control on a form (localizability also = true). I set the frames header to "bla bla" and the language to English. Build compile etc... I then set the language to French and the header to "le bleu bleu". When I change the language back to English the header does not change back to "bla bla".

Maybe my error is in the way in which I declare my control's properties, but I have not been able to determine if it is so.

It would be much appreciated if someone could point me to applicable reading-material or give an example or such.

As always, help would be much appreciated.
 

bloukewer

Well-known member
Joined
Jul 2, 2004
Messages
88
Programming Experience
3-5
The error striketh again...

The following error occurs when I load a project with the localizable controls : "Null-reference exception"....

And then I get a bunch of the infamous windows-error icons where my controls used to be...
 

Ruffnekk

Member
Joined
Mar 17, 2005
Messages
17
Location
Rotterdam, Netherlands
Programming Experience
10+
That smells like not using an instance of your class. If you add the controls programmatically, make sure you create an instance of them.

E.g.:

Private myControl As New myCustomControl
myForm.Controls.Add(myControl)
 

bloukewer

Well-known member
Joined
Jul 2, 2004
Messages
88
Programming Experience
3-5
Ya, no it's not that. I checked. The error-icons appear at design-time and replaces each and every control, not just my custom controls.

But I found a solution to the whole localization thing. I'm creating the whole system based on a multi-tier approach. As a result my presentation tier is totally seperate from any business- or database programming. So all I have to do is to develop two (or three, depending on the amount of user languages) copies of the presentation tier, translate each one to a specified language, and then create a neutral entry-point where the user can choose the language in which the program must run. Once he does this, based on his choice, I can just use the process.start method to start whichever presentation-tier is in that language. Voila! I know it's not the perfect solution but hey, it works great for my situation! In fact, it's much less of a hassle than the "correct" way.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
(unless i read your last post wrong) so you've made your application into several applications all using the same data&business tiers?

assuming that's correct (of which it is a solution to the problem) another way you could accomplish this (using the same approach of having different presentation tiers) is to start the application from the Sub Main and in there have it read a config file (that you've made) if the file doesnt exist then show a "which language" type window and simply use Application.Run(frmEnglish) or whatever form(s) is used for the english presentation tier and be sure that after the first run of the application that config file gets written so next time that app is run it'll just load the english form(s) without bothering the user as to which language to use

just a suggestion, i've just recently started using that above method and i'm liking it
 

bloukewer

Well-known member
Joined
Jul 2, 2004
Messages
88
Programming Experience
3-5
Sounds good...

But actually I have a database tier that keeps record of the user. It also keeps the user's lanuage preference so the next time a specific user logs in it automatically loads the correct presentation tier for that user.
 
Top Bottom