Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

CHANGE FORM TEXT BEFORE IT SHOW TO USER

Hi All,

I want to dynamically change form text before the visible to user.

The reason why I want to do it, is for localization.

How could I do it ?

Thank you.
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

try do it in the form load event.

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'Do your stuff here...

    End Sub

Open in new window

Avatar of emi_sastra
emi_sastra

ASKER

The event shows the form text at design time.

me.text = parmFormText

Before the change text is executed.

Thank you.
what do you mean by that?

check this out if this is useful.

Order of Events in Windows Forms
https://msdn.microsoft.com/en-us/library/86faxx0d(v=vs.110).aspx
It first show the form text that is fill at design time.

Then the coding that change the form text.

Thank you.
You may try it  to prove it.

Thank you.
in form load event, it should overwritten the value that set in design time.
You may try it  to prove it.

Thank you.
well, can you share some of your codes? sometimes just don't have luxury to build from scratch..
Have a look at this article I wrote a long time ago on Localization: http://emoreau.com/Entries/Articles/2004/07/Localization.aspx
If i provide a form for you then it will have a lot of compile error.

I f you have a visual studio project, it is easy, just add a new form.

Public Class Form1

   Public strFormText as string = "New Form Text"

       Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

         me.text - me.strFormText

      End Sub

End Class

Hope you could prove it.

Thank you.
other then replacing the - with = when assigning the Text property, your code here is good and working as expected.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Eric,

Yes, it works perfectly.

Thank you very much.f