G
Guest
I have a MDI Windows Form application, within it I have three child forms
that allows a user to provide about 5 paragraphs of text. Instead creating a
large multi-line text box on the child form, I created a "Detail" form, which
contains the large textbox, that the three forms can share.
This detail form is reused by all three forms to capture the user text. I
intended to pass the child form name and child form property in the detail
constructor, then at runtime have the form pass the user text back to calling
form.
Unfortunately because the three forms that are calling the shared Detail
form are child forms of the master mdi form, I can't set them as
mdiContainers, so I can't call the mdiParent parent property in the Detail
Form.
Ideally my code would look something like this:
Form that calls Detail Form:
Form that calls Detail Form:
Friend WriteOnly Property Statement() As String
Set(ByVal Value As String)
mStatement = Value
End Set
End Property
Private Sub btnStatement_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStatement.Click
Dim detail As New detail(me.getType, "Statement")
detail.ShowDialog()
End Sub
The Detail Form code:
Public Sub New(ByVal FormType as Type, ByVal FormPropertyName As String)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
mFormType = FormType
mFormPropertyName = FormPropertyName
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
[mFormType].[mFormPropertyName].txtUserText.Text 'Pseudo Code
' Hard Code would be: AppName.ChildFormName.Statement =
txtUserText.Text
End Sub
Any thoughts on how to accomplish? Please post code samples in VB. Thanks.
Josh.
that allows a user to provide about 5 paragraphs of text. Instead creating a
large multi-line text box on the child form, I created a "Detail" form, which
contains the large textbox, that the three forms can share.
This detail form is reused by all three forms to capture the user text. I
intended to pass the child form name and child form property in the detail
constructor, then at runtime have the form pass the user text back to calling
form.
Unfortunately because the three forms that are calling the shared Detail
form are child forms of the master mdi form, I can't set them as
mdiContainers, so I can't call the mdiParent parent property in the Detail
Form.
Ideally my code would look something like this:
Form that calls Detail Form:
Form that calls Detail Form:
Friend WriteOnly Property Statement() As String
Set(ByVal Value As String)
mStatement = Value
End Set
End Property
Private Sub btnStatement_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStatement.Click
Dim detail As New detail(me.getType, "Statement")
detail.ShowDialog()
End Sub
The Detail Form code:
Public Sub New(ByVal FormType as Type, ByVal FormPropertyName As String)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
mFormType = FormType
mFormPropertyName = FormPropertyName
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
[mFormType].[mFormPropertyName].txtUserText.Text 'Pseudo Code
' Hard Code would be: AppName.ChildFormName.Statement =
txtUserText.Text
End Sub
Any thoughts on how to accomplish? Please post code samples in VB. Thanks.
Josh.