DjJohnny
asked on
Fill Dataset from another form
Hi Experts,
VS 2008,SQL 2005.
I have a form with a split container. The first panel has a tree control.On the 2nd panel I fill with a form at run time , If the first node is clicked I load a customer form in the panel. If the 2nd node is clicked I load a Job form.I also have it check to see if the form that is needed on the 2nd panel is already loaded,if so I want to just update the data. I am trying to refill the dataset on the form in the 2nd panel but the following code id not working.
frmSubCustomer.FillCustome rDetail(Se lectedCust omerID) This is a sub on the frmSubCustomer
this is the code:
Private Sub FillsubCustomerForm()
Dim SubFrm As New frmSubCustomer
SelectedCustomerID = Me.TreeCustomer.SelectedNo de.Tag
If Me.SplitContainer1.Panel2. Controls.C ount > 0 Then
If Me.SplitContainer1.Panel2. Controls(0 ).Name = "frmSubCustomer" Then
frmSubCustomer.FillCustome rDetail(Se lectedCust omerID)
Else
Me.SplitContainer1.Panel2. Controls.C lear()
With SubFrm
.CurrentCustomerID = SelectedCustomerID
.TopLevel = False
.Dock = DockStyle.Fill
.WindowState = FormWindowState.Maximized
.Parent = Me
Me.SplitContainer1.Panel2. Controls.A dd(SubFrm)
.Show()
End With
End If
Any help would be great. If you can think of a better way of doing this I wold like to see it as I am just starting to develop this App
Thank You
John
VS 2008,SQL 2005.
I have a form with a split container. The first panel has a tree control.On the 2nd panel I fill with a form at run time , If the first node is clicked I load a customer form in the panel. If the 2nd node is clicked I load a Job form.I also have it check to see if the form that is needed on the 2nd panel is already loaded,if so I want to just update the data. I am trying to refill the dataset on the form in the 2nd panel but the following code id not working.
frmSubCustomer.FillCustome
this is the code:
Private Sub FillsubCustomerForm()
Dim SubFrm As New frmSubCustomer
SelectedCustomerID = Me.TreeCustomer.SelectedNo
If Me.SplitContainer1.Panel2.
If Me.SplitContainer1.Panel2.
frmSubCustomer.FillCustome
Else
Me.SplitContainer1.Panel2.
With SubFrm
.CurrentCustomerID = SelectedCustomerID
.TopLevel = False
.Dock = DockStyle.Fill
.WindowState = FormWindowState.Maximized
.Parent = Me
Me.SplitContainer1.Panel2.
.Show()
End With
End If
Any help would be great. If you can think of a better way of doing this I wold like to see it as I am just starting to develop this App
Thank You
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How far have you got? Are you handling the Tree's clicked event? You can handle the Tree's clicked event. If a click is detected, check if it's the 1st node or the 2nd one. Then check if the associated form is already loaded. If so, just refresh the data
ASKER
Thank You appari and philipjonathan,
appari code worked. I see now that I need to create an object that I set as the form in the panel2. I was just trying to get to it directly.
John
appari code worked. I see now that I need to create an object that I set as the form in the panel2. I was just trying to get to it directly.
John