ChildFormDialog-Question/Problem


Author
Message
Thomas Holste
Thomas Holste
Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Edhy,

thanks for your help. I want to use the grid because of the many abilities the datagridview offers. I tried the stratalistview which looks really nice but is to basic for me )and has it ever left the beta-status behind?). I use it in another project but in my recent project I want to use datagridviews because of the many possibilities they offer (For example, some other grids I will use need comboboxes and checkboxes instead of textboxes for presenting and editing grid-data and this seems to be far beyond the possibilities of the listview or the stratalistview. If this task is not to realise I will implement the child-windo wothout the childformdialog-control.

Best regards

Thomas
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Thomas,

If the data shown in the datagridview is presented to user as ReadOnly, then you could use a SF ListView which has build-in automation to show and manage a childformdialog, also you can easily color the rows based on the data conditions.
Or you can use the new StrataListView which is faster and more flexible than the SF Listview, it does not have the childform automation, but I posted a subclass version with some support for automation here: http://forum.strataframe.net/FindPost28459.aspx I even posted a VB sample project.

Also Trent posted a C# sample here: http://forum.strataframe.net/FindPost24981.aspx

Edhy Rijo

Edited 13 Years Ago by Edhy Rijo
Thomas Holste
Thomas Holste
Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 reputation)Advanced StrataFrame User (534 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...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search