open a child form and display specifics base on another child form

icookiprog

New member
Joined
Apr 3, 2007
Messages
2
Programming Experience
3-5
can some help me out with this problem. I am using VB.NET 2005 and SQL 2K.
i have a frmParent which is an MDI form. frmClients and frmCases are the children of frmParent. I have a toolbar on frmParent from which I can open and close the children. What I would like to achieve is when I have the frmClients opens and I am displaying a clientno = 1234 (an identity field) details, I would also like for frmCases to open and go directly to the current client's cases when I click on the open frmCases icon on the toolbar. frmClients will not be visible while I view the cases. It will be visible again when I closed out of frmCases. On the other hand, if frmClients is not open, I would just want frmCases to open and load all the cases ordered by caseno (also an identity field). I am able to do this part. It is opening frmClients, storing the current clientno, passing current clientno to frmContainer (or should it be frmCases? not sure) and opening frmCases to display current clientno cases part that I have no idea how to do. Any help on this is greatly appreciated.
 
VB.NET:
Public Class Form1
    Inherits Form

    'Drop a label on the form
    Private _myID as Integer

    Property ID as Integer
    Get
       Return _myID
    End Get
    Set (Byval value as Integer)
       _myID = value
    End Set
    End Property

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If _myID > 0 Then
            'load ID information
            Me.Label1.Text = "User ID: " & _myID
        Else
            'display grid with every information
            Me.Label1.Text = "No user id to display"
        End If
    End Sub

End Class


Public Class CallerClass
            Inherits Form

    'Drop a botton on the form

    WithEvents frm1 As Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        frm1 = New Form1
        frm1.ID = 1
        frm1.ShowDialog()
       
        'Disable the botton when the form is opened
        Button1.Enabled = False

    End Sub


    Private Sub frm1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles frm1.Closed
        'enable the button when it's closed
        Button1.Enabled = True
    End Sub
End Class
 
Last edited:
Back
Top