Edward van Nijmweegen
asked on
How to access the property of a child usercontrol form in c# or vb.net
Hello,
I have a windows form with a panel wich include a usercontrol form.
Now i have to run some code on the main (parent) form, that checks the value of a property on the child form(usercontrol in panel).
I have created a public readonly property on the usercontrol, but when i try to read this i can't get the value.
I also get the error message "Conversion from string "" to type 'Integer' is not valid." on line If uc.rl1 = True.
Property on usercontrol:
Code on mainform that should read this property:
Thanks in advance.
Edward
I have a windows form with a panel wich include a usercontrol form.
Now i have to run some code on the main (parent) form, that checks the value of a property on the child form(usercontrol in panel).
I have created a public readonly property on the usercontrol, but when i try to read this i can't get the value.
I also get the error message "Conversion from string "" to type 'Integer' is not valid." on line If uc.rl1 = True.
Property on usercontrol:
Public ReadOnly Property rl1() As Boolean
Get
Dim r As Integer
r = CInt(Me.txtRowIndex.Text)
If r > -1 Then
Return DGTimeTable.Item(4, r).Value
Else
Return False
End If
End Get
End Property
Code on mainform that should read this property:
Dim buffer As Byte()
ReDim buffer(2)
Dim uc As ucTestform = New ucTestform
uc = Me.ucPanel.Controls.Find("ucTestform", False)(0)
If uc.rl1 = True Then buffer(0) = buffer(0) Or 128 Else buffer(0) = buffer(0) And 127
Thanks in advance.
Edward
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot both of you.
Regards,
Edward