When I edit the field my issue is that I don't know how to make the debtors screen dirty so that save is enabled.
You should be able to set the change flag on the debtor to true and then usually there is a function called CheckEditStatus on most forms including debtors, if its not publicly available there is an old expression
fake it to you make it, just set the debtor name equal to the debtor name and that will make things detect the change.
And also how do I make that particular row dirty - i.e how do I set the ChangeFlag property to true?
You need to attach a change event to grdContactNames for example below is the one from Jiwa for the contact grid itself, yours should follow behind just looking for your column
- Code: Select all
Private Sub grdContactNames_Change(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.ChangeEventArgs)
Dim TempString As String = ""
Dim Title As String = ""
Dim FirstName As String = ""
Dim Surname As String = ""
Dim Phone As String = ""
Dim Mobile As String = ""
Dim Fax As String = ""
Dim Email As String = ""
Dim LogonCode As String = ""
Dim LogonPassword As String = ""
If Debtor.IsReading = False Then
With grdContactNames
If e.Row >= 0 Then
TempString = .GridText(.ActiveSheet.Columns(e.Column).Tag, e.Row)
Dim Key As String = .GridText("Key", e.Row)
If Key.Length = 0 Then
Dim contactName As JiwaDebtors.ContactName = Manager.CollectionItemFactory.CreateCollectionItem(Of JiwaDebtors.ContactName)()
Select Case .ActiveSheet.Columns(e.Column).Tag
Case "Title"
contactName.Title = TempString
Case "FirstName"
contactName.FirstName = TempString
Case "Surname"
contactName.Surname = TempString
Case "Phone"
contactName.Phone = TempString
Case "Mobile"
contactName.Mobile = TempString
Case "Fax"
contactName.Fax = TempString
Case "Email"
contactName.EmailAddress = TempString
Case "LogonCode"
contactName.LogonCode = TempString
Case "LogonPassword"
contactName.LogonPassword = TempString
End Select
_Debtor.ContactNames.Add(contactName)
Else
Key = .GridText("Key", e.Row)
If Key.Trim.Length > 0 Then
Select Case .ActiveSheet.Columns(e.Column).Tag
Case "Title"
_Debtor.ContactNames(Key).Title = TempString
Case "FirstName"
_Debtor.ContactNames(Key).FirstName = TempString
Case "Surname"
_Debtor.ContactNames(Key).Surname = TempString
Case "Phone"
_Debtor.ContactNames(Key).Phone = TempString
Case "Mobile"
_Debtor.ContactNames(Key).Mobile = TempString
Case "Fax"
_Debtor.ContactNames(Key).Fax = TempString
Case "Email"
_Debtor.ContactNames(Key).EmailAddress = TempString
Case "LogonCode"
_Debtor.ContactNames(Key).LogonCode = TempString
Case "LogonPassword"
_Debtor.ContactNames(Key).LogonPassword = TempString
End Select
End If
End If
End If
End With
End If
End Sub