ChildFormDialog-Question/Problem


Author
Message
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

I have a perentform which contains a datagridview to present and seek customer-data

and use a childformdialog to open a child-window to edit a selected record.

This is the code in my parent-form



Dim cErr As String = ""

Me.KundenBO1.Edit()

If Me.ChildKundNeu.ShowDialog(False, Me) = DialogResult.OK Then

If KundenBO1.Save <> MicroFour.StrataFrame.Data.SaveUndoResult.Success Then

cErr = "Fehler beim Speichern!"

mymsgbox(cErr, 48, cProgtitle)

Else

cErr = "Satz gespeichert!"

mymsgbox(cErr, 64, cProgtitle)

End If

Else

cErr = "Abbruch"

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

mymsgbox(cErr, 64, cProgtitle)

End If



So far, so good. The first parameter in the constructor determines, if a record ist added (True) or edited (False). Now whe I edit a record I want enable the use to undo changes in the child-form without closing and opening it again. So I put an "Undo-Button" on the form and call the Undo-Method of the childform-BO which is set up in the BO-Translations of the childformdialog as the destination BO.



KundenBO1.Undo(MicroFour.StrataFrame.Business.BusinessUndoType.CurrentRowOnly)



But this leads to the following error (Translated from german):

"Invalid conversion from type DBNull to type string"

And this is where it happens:



Public Overrides Sub SetValue(ByVal component As Object, ByVal value As Object)

Select Case Me.Field

Case KundenBOFieldNames.KUNDENNR

DirectCast(component, KundenBO).KUNDENNR = CType(value, System.Int32)

Case KundenBOFieldNames.ANREDE

DirectCast(component, KundenBO).ANREDE = CType(value, System.String)



The last Directcast is where the error happens.

I wonxder now if I am doing something wrong or if this can not be done this way.

Thanks for your help

Thomas
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Thomas Holste - 12 Years Ago
Edhy Rijo - 12 Years Ago
Thomas Holste - 12 Years Ago
Edhy Rijo - 12 Years Ago
Thomas Holste - 12 Years Ago
                         Hi Thomas, I am glad you are finding your way out :P Now for the...
Edhy Rijo - 12 Years Ago
                             Hi Edhy, thanks again for your help. The problem was that I had to...
Thomas Holste - 12 Years Ago
                                 Well, the BindingProperty for combobox should be set to SelectedValue...
Edhy Rijo - 12 Years Ago
                                     Hi Edhy, is your property-sheet-example from a combobox set to...
Thomas Holste - 12 Years Ago
                                         [quote][b]Thomas Holste (7/26/2012)[/b][hr]When I set it to...
Edhy Rijo - 12 Years Ago
                                             Hi Edhy, I set BindingProperty to "selected value" and set the values...
Thomas Holste - 12 Years Ago
                                                 Hi Thomas, Well this is one of those things where one can easily make...
Edhy Rijo - 12 Years Ago
                                                     Hi Edhy, thanks for your patience. I've layed this issue aside for a...
Thomas Holste - 12 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search