PC Review


Reply
Thread Tools Rate Thread

Accessing a control from on form to another in MDI

 
 
Gary Townsend
Guest
Posts: n/a
 
      18th Aug 2005
I have seen similar requests to this but not quite what i was looking for i
have an mdi interface and i have 3 child forms 2 are application forms
(meaning they do stuff for the application) and the other is a debug window
with a multiline text field for displaying debug messages within the
application.

What happens is i load the debug form on the mdi parents load event and
minimize it then i load my application forms. What i want to know is how to
be able to write messages to the debug window. I had at one point tried to
create the debug window as a global property of the MDI parent but i haven't
been able to reference the frmDebug property that i made within my child
forms. So now i am looking for other suggestions.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2VycnkgTW9vcm1hbg==?=
Guest
Posts: n/a
 
      18th Aug 2005
Gary,

Create a "global" variable on the MDI form to reference the debug form:

Public debugForm As Form2

In the MDI form's Load event, load the debug form:

debugForm = New Form2

debugForm.MdiParent = Me

debugForm.Show()

On any MDI Child application form, write to the debug form:

Dim f As Form1 = Me.MdiParent

f.debugForm.TextBox2.Text = f.debugForm.TextBox2.Text &
ControlChars.NewLine & "Debug info"

Kerry Moorman



"Gary Townsend" wrote:

> I have seen similar requests to this but not quite what i was looking for i
> have an mdi interface and i have 3 child forms 2 are application forms
> (meaning they do stuff for the application) and the other is a debug window
> with a multiline text field for displaying debug messages within the
> application.
>
> What happens is i load the debug form on the mdi parents load event and
> minimize it then i load my application forms. What i want to know is how to
> be able to write messages to the debug window. I had at one point tried to
> create the debug window as a global property of the MDI parent but i haven't
> been able to reference the frmDebug property that i made within my child
> forms. So now i am looking for other suggestions.
>
>
>

 
Reply With Quote
 
Gary Townsend
Guest
Posts: n/a
 
      19th Aug 2005
Thanks Kerry right after i sent it i had a brain wave and figured if i
created a public debug window object on the child form i could load the
debug window on the parent form then pass the parent window's debug window
to the child when it loads, i then created a public sub on the debug form
that takes care of my writing to the text box.: Makes more sense if i show
it:

Public Class frmParent
Inherits System.Windows.Forms.Form
Public frmDebug As New Debug

Private Sub frmParent_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
frmDebug.MdiParent = Me
frmDebug.Show()
frmDebug.WindowState = FormWindowState.Minimized
End Sub

Private Sub OpenMap_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MenuOpenMapWindow.Click
Dim MapForm As New frmMain

MapForm.MdiParent = Me
MapForm.Show()
MapForm.DebuggingForm = frmDebug
End Sub

End Class

Public Class frmMain
Inherits System.Windows.Forms.Form
Public DebuggingForm As Debug

End Class


"Kerry Moorman" <(E-Mail Removed)> wrote in message
news:38BCE067-9D9E-468A-8C33-(E-Mail Removed)...
> Gary,
>
> Create a "global" variable on the MDI form to reference the debug form:
>
> Public debugForm As Form2
>
> In the MDI form's Load event, load the debug form:
>
> debugForm = New Form2
>
> debugForm.MdiParent = Me
>
> debugForm.Show()
>
> On any MDI Child application form, write to the debug form:
>
> Dim f As Form1 = Me.MdiParent
>
> f.debugForm.TextBox2.Text = f.debugForm.TextBox2.Text &
> ControlChars.NewLine & "Debug info"
>
> Kerry Moorman
>
>
>
> "Gary Townsend" wrote:
>
> > I have seen similar requests to this but not quite what i was looking

for i
> > have an mdi interface and i have 3 child forms 2 are application forms
> > (meaning they do stuff for the application) and the other is a debug

window
> > with a multiline text field for displaying debug messages within the
> > application.
> >
> > What happens is i load the debug form on the mdi parents load event and
> > minimize it then i load my application forms. What i want to know is how

to
> > be able to write messages to the debug window. I had at one point tried

to
> > create the debug window as a global property of the MDI parent but i

haven't
> > been able to reference the frmDebug property that i made within my child
> > forms. So now i am looking for other suggestions.
> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing control on one form from another markliam@gmail.com Microsoft C# .NET 3 14th Sep 2007 03:11 AM
Accessing Mdi Child Form Control form another one Kurtulus Microsoft VB .NET 3 6th Mar 2006 08:07 AM
NEWBIE Q - accessing a form control from outside of the form class garyspam@gmail.com Microsoft C# .NET 1 22nd May 2005 05:36 PM
Accessing a parent web form control from within a nested user control? Roy Microsoft ASP .NET 1 10th Feb 2005 07:09 PM
accessing a control on one from from within another form =?Utf-8?B?R2VyYWxkaW5lIEhvYmxleQ==?= Microsoft VB .NET 0 2nd Jun 2004 12:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:16 PM.