M
Mobile Boy 36
Hello,
I was writing a piece of test-code to translate controls on a form...
It seems that the control.name property is missing.
To confirm my supposition, I tried my code in a normal Net framework windows
application.
There you've got the name property.
Does someone know a workaround or a solution ?
This is my code ( the problem line is 'If ctl.Name = "label1" Then')
Public Shared Function TransLateForm(ByVal LanguageId As String, ByVal
FormName As System.Windows.Forms.Form, ByVal Text As String)
Dim ctl As System.Windows.Forms.Control
Dim ctlType As String
For Each ctl In FormName.Controls
TranslateControl(ctl, LanguageId, Text)
Next
End Function
Private Shared Sub TranslateControl(ByVal ctl As
System.Windows.Forms.Control, ByVal LanguageId As String, ByVal Text As
String)
Dim subctl As System.Windows.Forms.Control
Dim ctlType As String
ctlType = ctl.GetType.ToString
If ctl.Name = "label1" Then
CType(ctl, System.Windows.Forms.Label).Text = "Test"
End If
For Each subctl In ctl.Controls
TranslateControl(subctl, LanguageId, Text)
Next
End Sub
I was writing a piece of test-code to translate controls on a form...
It seems that the control.name property is missing.
To confirm my supposition, I tried my code in a normal Net framework windows
application.
There you've got the name property.
Does someone know a workaround or a solution ?
This is my code ( the problem line is 'If ctl.Name = "label1" Then')
Public Shared Function TransLateForm(ByVal LanguageId As String, ByVal
FormName As System.Windows.Forms.Form, ByVal Text As String)
Dim ctl As System.Windows.Forms.Control
Dim ctlType As String
For Each ctl In FormName.Controls
TranslateControl(ctl, LanguageId, Text)
Next
End Function
Private Shared Sub TranslateControl(ByVal ctl As
System.Windows.Forms.Control, ByVal LanguageId As String, ByVal Text As
String)
Dim subctl As System.Windows.Forms.Control
Dim ctlType As String
ctlType = ctl.GetType.ToString
If ctl.Name = "label1" Then
CType(ctl, System.Windows.Forms.Label).Text = "Test"
End If
For Each subctl In ctl.Controls
TranslateControl(subctl, LanguageId, Text)
Next
End Sub