Hi programmers,
Please help me with this little problem.
I am developing a small VB.NET project which has several forms.
Each form has a private sub similar to the one shown below:
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
If TabControl1.SelectedTab Is TabPage1 Then
If Estado1 = True Then
Cargador(Me)
Estado1 = False
End If
ElseIf TabControl1.SelectedTab Is TabPage2 Then
If Estado2 = True Then
Cargador(Me)
Estado2 = False
End If
ElseIf TabControl1.SelectedTab Is TabPage3 Then
If Estado3 = True Then
Cargador(Me)
Estado3 = False
End If
ElseIf TabControl1.SelectedTab Is tabpage_N Then
Endif
End Sub
I have the following codes inside a module:
module module1
Public Sub Cargador(ByVal MyForm1 As Form)
ReDim CtlPlc(MyForm1.Tabcontrol1.SelectedTab.Controls.Count)
end sub
end module
As you can see, the Cargador subroutine is being called frequently from every
form. I know that I cannot call the Cargador sub with a simple 'Cargador (Me)'.
I still need to pass other argumments for the 'TabControl1.SelectedTab'.
The problem is that I don't know how to reference
Tabcontrol1.SelectedTab
in
the Cargador's sub declaration.
The compiler highlights the 'TabControl' in the CtlPlc ReDim statement and gives me an error that says:
TabControl1 is not a member of system.windows.forms.form
I am new to programming. Any help will be appreciated.
Thanks in advance.