Childformdialog-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 there,

I have set up a childformdialog and want to have all the Add/EDIT-logic within the

childform. I call the childform with a param-object this way:



Dim aParam(1) As Object

aParam(0) = "N"    --->New record to add, the edit-button on the parentform would set an "E"

aParam(1) = "LIEFMAIN"    --> Name of the calling form

Childliefneu.ShowDialog(aParam)



In the childform I use the following code



Public Sub New(ByVal ParamArray aParam() As Object)

MyBase.new()

' Dieser Aufruf ist für den Designer erforderlich.

InitializeComponent()

' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.

If aParam(0) = "N" Then

Me.lNeu = True

Me.Text = "Lieferanten aufnehmen"   -->"Add a supplier"

LieferBO1.Add()

Else

Me.lNeu = False

Me.Text = "Lieferanten bearbeiten"   --> "Edit a supplier"

LieferBO1.Edit()

End If

Me.cModule = aParam(1)

LieferBO1.Refresh()

Me.Refresh()

End Sub



When I call the childform to add a record, the form does not show an empty record which I expected to be added but the record the current row index points to and the controls are all disabled.

Is my approach wrong or did I miss something?

Thanks in advance

Thomas
Replies
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 Ben,

thanks a lot for your explanation. That shoqs me clearly why some of my approaches

went wrong. I Will try this immediately.

Best regards

Thomas
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 Ben,

I tried it and shifted the add edit code into an Overwritten onload-method



Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

MyBase.OnLoad(e)

If Me.lNeu Then

LieferBO1.Add()

Else

LieferBO1.Edit()

End If

LieferBO1.Refresh()

Me.Refresh()

End Sub



Now the follwing happens: If I start the form with a parameter for editing, the correct record is shown for editing. I can change values and save them, everything is fine.

When I choose to add a record. the form does not show, as I expected it, empty fiellds (controls like textboxes) for adding but behaves like I had choosen to add the actual record my grid is showing on the calling form.

Checking this with the debugger shows me, for example, that I enter the form with 79 records, the add-method of the BO is callled, after this I have 80 records, but the controls (text- and checkboxes and combos) aren't refreshed. 

What might I have done wrong?

Best regards

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