Parent Form - Child Form - Second Child Form


Author
Message
Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
On the Parent Form I am using a Listview and have successfully set it up so if I double click a record in the Parent BO it shows a Child form and list the child records of that parent in a listview.

Now when I double Click on one of the child Records I want to call a Form to Edit some of the data found in that child record. But, I get the following error when I double click the child reccod:



BusinessLayerException

There are no rows in the current data table. An edit is not allowed.



Source : MicroFour StrataFrame Business



Stack Trace:

at MicroFour.StrataFrame.Business.BusinessLayer.Edit(Boolean CheckSecurity)

at MicroFour.StrataFrame.UI.Windows.Forms.ListView.EditChildRecord()

at System.Windows.Forms.ListView.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)

at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



I am using a childformdialog to call the 2nd Child form. The 2nd child form never does appear. I have checked everything that I know to check but obviously I am missing some piece.

TIA.
Replies
Charles R Hankey
Charles R Hankey
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Forum Members
Posts: 524, Visits: 30K
You also might consider doing the save in the childform like so





Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click

Me.ContactResultsBO1.Undo(MicroFour.StrataFrame.Business.BusinessUndoType.CurrentRowOnly)

Me.DialogResult = Windows.Forms.DialogResult.Cancel

End Sub



Private Sub btn_Save(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

Me.ContactResultsBO1.Save()

Me.DialogResult = Windows.Forms.DialogResult.OK

End Sub





and then in the form with the listview





Private Sub lvContactResults_ChildFormResults(ByVal sender As Object, ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.ListViewChildFormResultsEventArgs) _

Handles lvContactResults.ChildFormResults



' Reads the return value from the ContactResults form and if the ADD has not been cancelled, requeries the

' listview to display the new record



If e.Results = Windows.Forms.DialogResult.OK Then

e.Requery = True

End If



End Sub







This way you are doing your save and cancels in the BO on the childform so you don't have to depend on the translation back to the calling form and you can handle the refreshing of the listview in the calling form itself ( and then you don't need the code you posted )





Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Alright I retooled my Parent-Child project to 2 forms a parent that shows the parent records and the child records if a parent is selected. Look at screenshot1 where no parents are selected and screenshot2 to see when a parent is selected.

Now the parent form seems to work as it should. Then when I double click a child record or the edit button on the toolbar I get the correct data on the child form using a childformdialog. See screenshot3.

Charles on one of your replies you asked "How are you getting the child records?" This is how I am doing it. I don't know if it is correct but it works.





Private Sub lvChild_BeforeChildFormExecuted(ByVal sender As System.Object, ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.ListViewBeforeChildExecuteEventArgs) Handles lvChild.BeforeChildFormExecuted



BbPointsBO1.FillByPrimaryKey(lvChild.SelectedItems(0).Tag)



End Sub





So if what I have is correct, why on the Child Form can I not edit the fields? I set the ManageUIReadOnlyState on the childBO to false but that did not help.



Op's I think I found the correct One IgnoreManageReadOnlyState on the textbox and combobox themselves. Also, the Save and Cancel buttons on the child form also work. So I guess my only question is, Am I getting my child data correctly before going to the child form?????



Thanks so much for all of your help. I feel like I have come a 1000 miles this week end in terms of what I have learned and now I need to step back and see if I can reproduce what I have done........

YEE HA!!!!!!
Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Forgot the pictures but here they are..
Attachments
ScreenShot001.gif (157 views, 16.00 KB)
ScreenShot002.gif (160 views, 14.00 KB)
ScreenShot003.gif (143 views, 17.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search