Difference between revisions of "AddressBook.Add"
From Xojo Documentation
(SMBot: new page by automated transformation) |
m (Text replacement - "{{Deprecated" to "{{DeprecatedItem") |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{DeprecatedItem|version=2019r2}} | ||
{{MethodBox | {{MethodBox | ||
| name=Add | | name=Add | ||
Line 5: | Line 6: | ||
| scope=public | | scope=public | ||
| parameters=Record as [[AddressBookRecord]] | | parameters=Record as [[AddressBookRecord]] | ||
− | | platform= | + | | platform=mac |
}} | }} | ||
− | Adds the record to the Address Book. | + | {{Description |
+ | |text = Adds the record to the Address Book. | ||
+ | }} | ||
+ | |||
+ | == Sample Code == | ||
+ | The following code adds a new contact to the address book. | ||
+ | <rbcode> | ||
+ | Dim book As New AddressBook | ||
+ | Dim myContact As AddressBookContact | ||
+ | book = System.AddressBook | ||
+ | myContact = New AddressBookContact | ||
+ | |||
+ | myContact.FirstName = "Xena" | ||
+ | myContact.LastName = "Smith" | ||
+ | myContact.CompanyName = "Xanadu" | ||
+ | myContact.JobTitle = "Free Lance" | ||
+ | |||
+ | book.Add(myContact) | ||
+ | |||
+ | If book.HasUnsavedChanges Then | ||
+ | If book.Save Then | ||
+ | MsgBox("The AddressBook was saved!") | ||
+ | End If | ||
+ | Else | ||
+ | MsgBox("There were no unsaved changes!") | ||
+ | End If | ||
+ | </rbcode> |
Latest revision as of 19:05, 3 September 2020
![]() |
This item was deprecated in version 2019r2. |
Method
![]() |
This method is only available on the macOS platform. For cross-platform compatibility, use #If...#Endif with the Target... specifiers to make sure you will not attempt to use this method on an incompatible platform. |
Adds the record to the Address Book.
Sample Code
The following code adds a new contact to the address book.
Dim book As New AddressBook
Dim myContact As AddressBookContact
book = System.AddressBook
myContact = New AddressBookContact
myContact.FirstName = "Xena"
myContact.LastName = "Smith"
myContact.CompanyName = "Xanadu"
myContact.JobTitle = "Free Lance"
book.Add(myContact)
If book.HasUnsavedChanges Then
If book.Save Then
MsgBox("The AddressBook was saved!")
End If
Else
MsgBox("There were no unsaved changes!")
End If
Dim myContact As AddressBookContact
book = System.AddressBook
myContact = New AddressBookContact
myContact.FirstName = "Xena"
myContact.LastName = "Smith"
myContact.CompanyName = "Xanadu"
myContact.JobTitle = "Free Lance"
book.Add(myContact)
If book.HasUnsavedChanges Then
If book.Save Then
MsgBox("The AddressBook was saved!")
End If
Else
MsgBox("There were no unsaved changes!")
End If