Difference between revisions of "KeychainItem.ServiceName"

From Xojo Documentation

m
Line 15: Line 15:
  
 
<rbcode>
 
<rbcode>
Dim kc As KeyChain
+
Var kc As KeyChain
Dim kci As KeyChainItem
+
Var kci As KeyChainItem
  
kc = New KeyChain(Listbox1.ListIndex)
+
kc = New KeyChain(Listbox1.SelectedIndex)
  
 
If kc <> Nil Then
 
If kc <> Nil Then
 
   kci = New KeyChainItem
 
   kci = New KeyChainItem
   kci.ServiceName = SearchField.Text
+
   kci.ServiceName = SearchField.Value
 
    
 
    
   PasswordField.Text = kc.FindPassword(kci)
+
   PasswordField.Value = kc.FindPassword(kci)
 
    
 
    
   ServiceNameField.Text = kci.ServiceName
+
   ServiceNameField.Value = kci.ServiceName
   AccountNameField.Text = kci.AccountName
+
   AccountNameField.Value = kci.AccountName
   CommentField.Text = kci.Comment
+
   CommentField.Value = kci.Comment
   LabelField.Text = kci.Label
+
   LabelField.Value = kci.Label
 
End If
 
End If
 
</rbcode>
 
</rbcode>

Revision as of 23:18, 20 July 2019

Property (As String )


aKeyChainItem.ServiceName = newStringValue
or
StringValue = aKeyChainItem.ServiceName

Supported for all project types and targets.

Contains the name of the service (required for adding, can be Nil to find). To add a password for an application, set ServiceName to the application’s name.

Example

This example set the text of a TextField to the description of a KeyChainItem.

Var kc As KeyChain
Var kci As KeyChainItem

kc = New KeyChain(Listbox1.SelectedIndex)

If kc <> Nil Then
kci = New KeyChainItem
kci.ServiceName = SearchField.Value

PasswordField.Value = kc.FindPassword(kci)

ServiceNameField.Value = kci.ServiceName
AccountNameField.Value = kci.AccountName
CommentField.Value = kci.Comment
LabelField.Value = kci.Label
End If