Version

KeyMember Property (OwnersDataBinding)

Gets/sets the field to use to initialize the owner’s Key property when bound.
Syntax
'Declaration
 
Public Property KeyMember As String
public string KeyMember {get; set;}
Example
The following code creates a Datatable with the proper schema to bind to the Owners collection of an UltraCalendarInfo and then sets all the appropriate bindings.

#Region " CreateOwnersDataTable"
    Private Function CreateOwnersDataTable() As DataTable
        Dim newTable As New DataTable()

        'Basic Owner properties
        ' In order to function properly, the table must contain data for 
        ' the Owners Key. Keys are required for an Owner. 
        newTable.Columns.Add("Key", GetType(String))
        newTable.Columns("Key").Unique = true

        'Other Owner properties
        newTable.Columns.Add("Name", GetType(String))
        newTable.Columns.Add("EmailAddress", GetType(String))
        newTable.Columns.Add("Visible", GetType(Boolean))

        'Unlike Appointments, the Owner properties are all covered by 
        'individual members. But we could save space in the database by storing
        'data as binary imports AllProperties and not binding the other fields. 
        newTable.Columns.Add("AllProperties", GetType(Byte()))
        Return newTable
    End Function

#End Region 


#Region " SetOwnerBindings "
    'Set the Data Bindings for Owners
    Private Sub SetOwnerBindings()
        ' DataSource & DataMember
        Me.ultraCalendarInfo1.DataBindingsForOwners.SetDataBinding(Me.scheduleData, "Owners")

        ' Set the BindingContextControl so the component will use the same context
        ' that the grid and any other controls on the form are using. 
        Me.ultraCalendarInfo1.DataBindingsForOwners.BindingContextControl = Me

        ' Basic Owner properties
        Me.ultraCalendarInfo1.DataBindingsForOwners.KeyMember = "Key"
        Me.ultraCalendarInfo1.DataBindingsForOwners.NameMember = "Name"
        Me.ultraCalendarInfo1.DataBindingsForOwners.EmailAddressMember = "EmailAddress"
        Me.ultraCalendarInfo1.DataBindingsForOwners.VisibleMember = "Visible"

        ' All other properties
        Me.ultraCalendarInfo1.DataBindingsForOwners.AllPropertiesMember = "AllProperties"
    End Sub
#End Region   'SetOwnerBindings
#region CreateOwnersDataTable
private DataTable CreateOwnersDataTable()
{
	DataTable newTable = new DataTable();

	//Basic Owner properties
	// In order to function properly, the table must contain data for 
	// the Owners Key. Keys are required for an Owner. 
	newTable.Columns.Add("Key", typeof(string));	
	newTable.Columns["Key"].Unique = true;

	//Other Owner properties
	newTable.Columns.Add("Name", typeof(string));
	newTable.Columns.Add("EmailAddress", typeof(string));
	newTable.Columns.Add("Visible", typeof(bool));

	//Unlike Appointments, the Owner properties are all covered by 
	//individual members. But we could save space in the database by storing
	//data as binary using AllProperties and not binding the other fields. 
	newTable.Columns.Add("AllProperties", typeof(Byte[]));
	return newTable;
}

#endregion CreateOwnersDataTable


#region SetOwnerBindings
//Set the Data Bindings for Owners
private void SetOwnerBindings()
{			
	// DataSource & DataMember
	this.ultraCalendarInfo1.DataBindingsForOwners.SetDataBinding(this.scheduleData, "Owners");
		
	// Set the BindingContextControl so the component will use the same context
	// that the grid and any other controls on the form are using. 
	this.ultraCalendarInfo1.DataBindingsForOwners.BindingContextControl = this;

	// Basic Owner properties
	this.ultraCalendarInfo1.DataBindingsForOwners.KeyMember = "Key";
	this.ultraCalendarInfo1.DataBindingsForOwners.NameMember = "Name";
	this.ultraCalendarInfo1.DataBindingsForOwners.EmailAddressMember = "EmailAddress";
	this.ultraCalendarInfo1.DataBindingsForOwners.VisibleMember = "Visible";
		
	// All other properties
	this.ultraCalendarInfo1.DataBindingsForOwners.AllPropertiesMember = "AllProperties";
}
#endregion SetOwnerBindings
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also