Retrieve the text property of all labels, buttons, forms,etc

  • Thread starter Thread starter Corobori
  • Start date Start date
Corobori said:
I need to have translated my application. How can I retrieve all
text properties of my control in one file ?

Have you already had a look at the localizable and language properties of
the Form?

See also:

<F1>
VS.NET
.NET Framework
Programming with the .NET Framework
Developing World-Ready Applications

VB and VC#
Creating applications
Globalizing and Localizing Applications


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
something like


Private Sub DoIt(ByVal frm as Form)
Dim list As New ArrayList
list.Add(frm.GetType.Name & " -> " & frm.Name & ": " & frm.Text)
AddRecursiveControls(frm.Controls, list)

Debug.WriteLine("--------------------")
For Each s As String In list
Debug.WriteLine(s)
Next s
Debug.WriteLine("--------------------")
End Sub

Private Sub AddRecursiveControls(ByVal cc As Control.ControlCollection,
ByVal list As ArrayList)
Dim ctr As Control
For Each ctr In cc
list.Add(ctr.GetType.Name & " -> " & ctr.Name & ": " & ctr.Text)
AddRecursiveControls(ctr.Controls, list)
Next ctr
End Sub


dominique
 
Have you already had a look at the localizable and language properties of
the Form?

Indeed I have and I am going to use it. But one way or the other the
translation needs to be done and I am not the one who will do this
job. There is a guy who is hired for that and will get all the words
to be translated.

My problem is how do I get all the text properties for my controls in
a file so that person can do the job.
 
wasn't my solution good enough ?

Sorry Dominique, I didn't see it. Yes, it looks fine. I am just
missing the bit on how to scan all forms of my projects, I tried
finding it myself but can't get it yet.

jean-luc
www.corobori.com
 
you can try something like this to find all forms in your project (for 1
assembly)...
your forms need to have a "no parameter" constructor
public sub new()
....
end sub



Imports System.Reflection
....
Dim asm As [Assembly] = [Assembly].GetCallingAssembly()
For Each t As Type In asm.GetTypes()
Debug.WriteLine(t.Name)
If (t.IsSubclassOf(GetType(Form))) Then
Dim frm As Form = DirectCast(Activator.CreateInstance(t), Form)
'do stuff with form...
End If
Next t
 
It's working fine.

Now is it possible to do the same for the Crystal Reports ?

jean-luc
 
Back
Top