i have two forms
Form1 and Form2
Form1 has a panel. It loads form2
Form2 has code like this
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
'Title of Control1
CType(Me.ParentForm, Form1).control1.Text = "Title bar text"
Needless to say this works fine
Here comes the problem:
I added a new form: Form3
also with a panel with Form2 inside
now i have a problem with this CType(Me.ParentForm, Form1).control1.Text
I would also like to have this fixed to accept any future parent form, instead of writing something like
if parentform.name = "form1" then
CType(Me.ParentForm, Form1).control1.Text = "bla1"
else if parentform.name = "form2" then
CType(Me.ParentForm, Form2).control1.Text = "bla bla2"
else if .....to infiniti
CType(Me.ParentForm, FormInfini).control1.Text = "blablablafiniti"