I am migrating a project written in Visual Basic to C#.
During the Load of a Form in VB I execute a function that uses the Controls of said Form and it works correctly.
However, when running the same function during Form Load in C#, the function does not work because it finds 0 Controls. So at what point are Controls created and assigned in VB and C#?
Code in Visual Basic:
New Form
Set Abertura(MiTag) = New aFrmAberturas
Case 32, 4, 7, 28 ' "VIDRIOS" '"ACRÍLICOS" '"CIEGOS", 28 '"TELA MOSQUITERA"
Set Abertura(MiTag) = New aFrmManualVi
My function during the Form Load
If Abertura(MiTag).LblRev1(1) = "Tela Mosquit" Then
.inter1(1, MHA) = "Vidrio Simple"
cambio = True
End If
Controls.Count at the IF
?aModule1.Abertura(MiTag).Count 165
Code in C#
New Form
aModule1.Abertura[aModule1.MiTag] = new aFrmAberturas();
break;
case 32 : case 4 : case 7 : case 28 : // "VIDRIOS" '"ACRÍLICOS" '"CIEGOS", 28 '"TELA MOSQUITERA"
aModule1.Abertura[aModule1.MiTag] = new aFrmManualVi();
My function during the Form Load
if (Convert.ToString(((dynamic) aModule1.Abertura[aModule1.MiTag])._LblRev1_) == "Tela Mosquit")
{
aModule1.Vars[aModule1.MiTag].Inter1[1, aModule1.MHA] = "Vidrio Simple";
cambio = true;
}
Controls.Count at the IF
aModule1.Abertura[aModule1.MiTag].Controls.Count 0
VB: Here is the Form's declaration
VB: This is my Function during the Form Load, and the Form's Controls.Count
C#: Here is the Form's declaration
C#: This is my Function during the Form Load, and the Form's Controls.Count