Hello, MFSPZ,
RPT1 is a function of the parent class. See the sample below for an example of calling Hd from within RPT1. Since your sample Hd function doesn't actually do anything, I have added a Debug.PrintLine statement to it to illustrate the result. I have also appended Button1_Click code to demonstrate how the Hd function can be invoked, first from within the RPT1 method, and then directly. Please see below.
Cheers,
Randy
Hello, MFSPZ,
RPT1 is a function of the parent class. See the sample below for an example of calling Hd from within RPT1. Since your sample Hd function doesn't actually do anything, I have added a Debug.PrintLine statement to it to illustrate the result. I have also appended Button1_Click code to demonstrate how the Hd function can be invoked, first from within the RPT1 method, and then directly. Please see below.
Cheers,
Randy
Public Class clsRap
Private glNr As String = "" ' not shared
Public Class clsHd
''Public Sub Hd(ByVal _D As Object)
'' Dim xx As String = glNr ' Here I get the error
'' ' I need the information set in RPT1 !!
''End Sub
Public Sub Hd(ByVal _D As Object, ByVal ParentClass As clsRap)
Dim xx As String = ParentClass.glNr
' I need the information set in RPT1 !!
Debug.WriteLine("The value of xx is """ & xx & """.")
End Sub
End Class
Public Function RPT1(ByVal _ID As String) As Boolean
Dim resultaat As Boolean = True
glNr = _ID
' Example showing a call to the nested class function
' from inside the parent class function RPT1.
Dim NestedHdClass As New clsHd
NestedHdClass.Hd(Nothing, Me)
Return resultaat
End Function
End Class 'clsRap
Public Class Rap1
Dim Doc As New clsRap
Sub Testit()
Debug.WriteLine("Value = " & Doc.RPT1("123"))
End Sub
End Class
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Example showing a call to the nested class function
' from inside the parent class function RPT1.
Dim SampleParentClass As New clsRap
SampleParentClass.RPT1("Set the glNr value to be this string.")
' Example showing a call to the nested class function
' from outside of the parent class.
Dim SampleNestedClass As New clsRap.clsHd
SampleNestedClass.Hd(Nothing, SampleParentClass)
End Sub
End Class