J
John Sheppard
Hello there I was wondering if anyone could help me,
I am trying to pass a typed dataset to a dialoged child form by reference.
I have binding sources sitting on the child form. So to refresh them I just
set their datasource. I am guessing this is probably what is causing the
problem. Is there a better way to do this?
Anyway this all works happily and things show up when the record already
exists but I have 2 problems ;
1) When I add a new row it doesnt seem to create a record correctly (its not
there when I look at the watch, but the count increases)
2) When the record already exists and I edit it the datagrid on the main
form doesnt update with any data
Here is my constructor code;
Public Sub New(ByVal theDs As myTypedDatast, ByVal createNew As Boolean,
Optional ByVal theMaterialId As Integer = -1, Optional ByVal theServiceId As
Integer = -1)
Me.new()
'Refresh the bindings
Me.BaseDs = theDs
Me.bsCostCodes.DataSource = Me.BaseDs
Me.bsVendor.DataSource = Me.BaseDs
Me.bsTransactions.DataSource = Me.BaseDs
If createNew Then
'MessageBox.Show(tblTransactions.Count)
bsTransactions.AddNew()
'MessageBox.Show(tblTransactions.Count))
CurrentTransaction.CostCode_Type = "M"
CurrentTransaction.ServiceID = theServiceId
CurrentTransaction.CreatedBy = myBlSingleton.currentUser.userID
CurrentTransaction.CreatedOn = Now()
CurrentTransaction.LastModifiedBy = myBlSingleton.currentUser.userID
CurrentTransaction.LastModifiedOn = Now()
CurrentTransaction.Transaction_Date = Now()
Else
tblTransactions.Find("seqNum", theMaterialId)
CurrentTransaction.LastModifiedBy = myBlSingleton.currentUser.userID
CurrentTransaction.LastModifiedOn = Now()
End If
End Sub
Private Function CurrentTransaction() As BMS.BL.dsBMS.tblTransactionsRow
If tblTransactions.Current IsNot Nothing AndAlso TypeOf
tblTransactions.Current.row Is BMS.BL.dsBMS.tblTransactionsRow Then
Return CType(tblTransactions.Current.row, BMS.BL.dsBMS.tblTransactionsRow)
Else
Return Nothing
End If
End Function
Thank you kindly
John Sheppard
I am trying to pass a typed dataset to a dialoged child form by reference.
I have binding sources sitting on the child form. So to refresh them I just
set their datasource. I am guessing this is probably what is causing the
problem. Is there a better way to do this?
Anyway this all works happily and things show up when the record already
exists but I have 2 problems ;
1) When I add a new row it doesnt seem to create a record correctly (its not
there when I look at the watch, but the count increases)
2) When the record already exists and I edit it the datagrid on the main
form doesnt update with any data
Here is my constructor code;
Public Sub New(ByVal theDs As myTypedDatast, ByVal createNew As Boolean,
Optional ByVal theMaterialId As Integer = -1, Optional ByVal theServiceId As
Integer = -1)
Me.new()
'Refresh the bindings
Me.BaseDs = theDs
Me.bsCostCodes.DataSource = Me.BaseDs
Me.bsVendor.DataSource = Me.BaseDs
Me.bsTransactions.DataSource = Me.BaseDs
If createNew Then
'MessageBox.Show(tblTransactions.Count)
bsTransactions.AddNew()
'MessageBox.Show(tblTransactions.Count))
CurrentTransaction.CostCode_Type = "M"
CurrentTransaction.ServiceID = theServiceId
CurrentTransaction.CreatedBy = myBlSingleton.currentUser.userID
CurrentTransaction.CreatedOn = Now()
CurrentTransaction.LastModifiedBy = myBlSingleton.currentUser.userID
CurrentTransaction.LastModifiedOn = Now()
CurrentTransaction.Transaction_Date = Now()
Else
tblTransactions.Find("seqNum", theMaterialId)
CurrentTransaction.LastModifiedBy = myBlSingleton.currentUser.userID
CurrentTransaction.LastModifiedOn = Now()
End If
End Sub
Private Function CurrentTransaction() As BMS.BL.dsBMS.tblTransactionsRow
If tblTransactions.Current IsNot Nothing AndAlso TypeOf
tblTransactions.Current.row Is BMS.BL.dsBMS.tblTransactionsRow Then
Return CType(tblTransactions.Current.row, BMS.BL.dsBMS.tblTransactionsRow)
Else
Return Nothing
End If
End Function
Thank you kindly
John Sheppard