MDIParent Statusbar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Remblance

    #1

    MDIParent Statusbar

    I have tried several approaches to update the mdiparent status bar from a
    module.

    A bit complicated as the path could be:
    Parent -> Child1 -> dialog1 -> module.sub (long process)
    Parent -> Child2 -> dialog2 -> module.sub (long process)
    Parent -> Child3 -> dialog3 -> module.sub (long process)
    etc. (being a dialog only one process can run at a time)

    Tried:

    In the module:
    dim frm as new Parent
    frm.statusbar.p age1.text = "something"

    Even tried in the parent:
    Public Sub UpdateStatusbar (byval strText as String)
    statusbar.page1 .text = "something"
    End Sub
    But sub UpdateStatusbar cannot be seen in Module1

    Any ideas or can it not be done?

    Thanks, Paul


  • Ken Tucker [MVP]

    #2
    Re: MDIParent Statusbar

    Hi,

    You need a reference to the form. If you only have one
    instance of the form running at once you can add a shared property to the
    form to get reference. Add the follow code to the mdi parent form. Change
    frmMdiParent with your forms name

    Add to the forms new procedure

    Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeCompo nent()

    'Add any initialization after the InitializeCompo nent() call
    frm = Me
    End Sub

    Add to the forms dispose procedure

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Disp ose()
    End If
    End If
    frm = Nothing
    MyBase.Dispose( disposing)
    End Sub


    Add the following code to the form

    Private Shared frm As frmMDIParent

    Public Shared ReadOnly Property DefInstance() As frmMDIParent
    Get
    If frm Is Nothing Then frm = New frmMDIParent
    Return frm
    End Get
    End Property


    To use

    Module test

    Public Sub changeStatus()
    frmMDIParent.De fInstance.Statu sBar1.Text = "Live from module"
    End Sub
    End Module


    Ken
    -----------------------
    "Paul Remblance" <paul@remblance .co.uk> wrote in message
    news:3oq8dvF77s joU1@individual .net...[color=blue]
    >I have tried several approaches to update the mdiparent status bar from a
    >module.
    >
    > A bit complicated as the path could be:
    > Parent -> Child1 -> dialog1 -> module.sub (long process)
    > Parent -> Child2 -> dialog2 -> module.sub (long process)
    > Parent -> Child3 -> dialog3 -> module.sub (long process)
    > etc. (being a dialog only one process can run at a time)
    >
    > Tried:
    >
    > In the module:
    > dim frm as new Parent
    > frm.statusbar.p age1.text = "something"
    >
    > Even tried in the parent:
    > Public Sub UpdateStatusbar (byval strText as String)
    > statusbar.page1 .text = "something"
    > End Sub
    > But sub UpdateStatusbar cannot be seen in Module1
    >
    > Any ideas or can it not be done?
    >
    > Thanks, Paul
    >[/color]


    Comment

    • Paul Remblance

      #3
      Re: MDIParent Statusbar

      Many thanks, Paul

      "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
      news:uB4ITRRuFH A.3236@TK2MSFTN GP14.phx.gbl...[color=blue]
      > Hi,
      >
      > You need a reference to the form. If you only have one
      > instance of the form running at once you can add a shared property to the
      > form to get reference. Add the follow code to the mdi parent form.
      > Change frmMdiParent with your forms name
      >
      > Add to the forms new procedure
      >
      > Public Sub New()
      > MyBase.New()
      >
      > 'This call is required by the Windows Form Designer.
      > InitializeCompo nent()
      >
      > 'Add any initialization after the InitializeCompo nent() call
      > frm = Me
      > End Sub
      >
      > Add to the forms dispose procedure
      >
      > Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
      > If disposing Then
      > If Not (components Is Nothing) Then
      > components.Disp ose()
      > End If
      > End If
      > frm = Nothing
      > MyBase.Dispose( disposing)
      > End Sub
      >
      >
      > Add the following code to the form
      >
      > Private Shared frm As frmMDIParent
      >
      > Public Shared ReadOnly Property DefInstance() As frmMDIParent
      > Get
      > If frm Is Nothing Then frm = New frmMDIParent
      > Return frm
      > End Get
      > End Property
      >
      >
      > To use
      >
      > Module test
      >
      > Public Sub changeStatus()
      > frmMDIParent.De fInstance.Statu sBar1.Text = "Live from module"
      > End Sub
      > End Module
      >
      >
      > Ken
      > -----------------------
      > "Paul Remblance" <paul@remblance .co.uk> wrote in message
      > news:3oq8dvF77s joU1@individual .net...[color=green]
      >>I have tried several approaches to update the mdiparent status bar from a
      >>module.
      >>
      >> A bit complicated as the path could be:
      >> Parent -> Child1 -> dialog1 -> module.sub (long process)
      >> Parent -> Child2 -> dialog2 -> module.sub (long process)
      >> Parent -> Child3 -> dialog3 -> module.sub (long process)
      >> etc. (being a dialog only one process can run at a time)
      >>
      >> Tried:
      >>
      >> In the module:
      >> dim frm as new Parent
      >> frm.statusbar.p age1.text = "something"
      >>
      >> Even tried in the parent:
      >> Public Sub UpdateStatusbar (byval strText as String)
      >> statusbar.page1 .text = "something"
      >> End Sub
      >> But sub UpdateStatusbar cannot be seen in Module1
      >>
      >> Any ideas or can it not be done?
      >>
      >> Thanks, Paul
      >>[/color]
      >
      >[/color]


      Comment

      Working...