How to call a sub in mdi parent from child form


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to call a sub in mdi parent from child form

Threaded View

  1. #1
    cat_dog Guest

    How to call a sub in mdi parent from child form

    i use mdi to manage several forms which one of the child form "frmJobList" contain a datagrid,
    how can i update another child form "frmNote" by clicking the datagrid only
    i use databinding method in "frmNote"

    The parent form is called "frmMain"

    There is a sub in "frmNote" which can update the bound textbox

    Public Sub MoveTo(ByVal intJobId As Long)
    SqlDvNote.Sort = "JobID"
    Me.BindingContext(SqlDvNote).Position() = SqlDvNote.Find(intJobId)
    End Sub

    There is another sub in "frmMain"

    Public Sub UpdateAllForms(ByVal intJobId As Long)
    If ChildFormExist("frmNote") Then
    chdNote.MoveTo(intJobId)
    End If
    End Sub

    i tried to call the sub in "frmMain" from the "frmJoblist" datagrid CurrentCellChanged event like below

    Public Sub dgJobList_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgJobList.CurrentCellChanged
    longJobID = dgJobList(dgJobList.CurrentRowIndex(), 0)
    dim frm as new frmMain
    frm.UpdateAllforms(longJobID)
    End Sub

    But it fails

    How can i refer to the parent from the child form?

    Hope u can understand

    Many thx
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center